huihuang1992
Joined: 12 Feb 2016 Posts: 9
|
|
Posted: Tue Feb 23, 2016 11:20 am |
|
|
Sorry for these disasters, it is my first time to do it..
Ttelmah wrote: |
First, in INT_RB, you _must_ read at least one bit of portB. This is in the data sheet, and has been explained here. The act of reading the port, is what sets the internal latch to match what is currently on the port. Until this happens, the interrupt cannot be cleared, and INT_RB will trigger forever, stopping the code from ever actually exiting the interrupt. Disaster...
Then INT_RDA, says 'a character has been received'. Testing kbhit is pointless...
Then you do not check that 'x' has not exceeded the size of the array. If data arrives that is not exactly what you want, this will result in memory becoming corrupted. Again disaster.
Then you have a line 'enable_interrupts', without a interrupt for it to enable. Doubt if this will compile. |
This interrupts was a fail.. sorry, because I was testing Timer1 and I don't have completed..
Ttelmah wrote: |
Then you send a huge sequence of commands to the modem. Every one of these will receive a reply from the modem (OK probably). You do nothing to empty the data buffer, so by the time you start looking for 'RING', the buffer will have a huge number of characters already in it. Result 'RING' won't be where you expect it.
|
That huge sequence is for searching location and send the information of location, and some of them respond OK, and every X time I have put "borrar_arrany()", which is used for empty the data buffer.
And about others, I will correct them.
Best regards. |
|