I think it may be getting stuck the second time around at the serial part.
Could give this a try...
Code:'-----[ Get RS232 Data input, and assign into MSB & LSB Data to be displayed ]------------------------------------ GetSerial: SerIn RS232,T9600,RS_Data 'Read Serial Data on Pin RS232 (A.4) and assign value into "RS_Data" GetData: 'Assign any of the "0123456789-" characters to "digits". LookDown RS_Data,["0123456789-"],Digits 'Match number from RS_Data, and assign 7seg data to it into Digits. IF Counter = 0 Then LookUp Digits,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F,$00],MSB 'If "Counter" is "0" then store in MSB. Else '( 0 1 2 3 4 5 6 7 8 9 - ) LookUp Digits,[$3F,$06,$5B,$4F,$66,$6D,$7D,$07,$7F,$6F,$00],LSB 'If "Counter" is "1" then store in LSB. EndIF IF Counter = 0 Then 'If counter=0, then this is the first digit to be processed. Counter = 1 'Now make counter=1, to show (next time) that the 2nd digit will be processed. GoTo GetData 'Repeat to get 2nd digit to process. Else ' Counter = 0 'Otherwise, make counter=0, ready to process 1st digit of the next "2 numbers to arrive". EndIF ' Return 'Return back to Start, and display MSB & LSB onto the 2x 7-Seg displays. '-----[ Display MSB & LSB Data onto 2x 7-Segment Displays ]------------------------------------------------------- Start: 'UNITS: seg7 = LSB 'place data "LSB" onto PortB 7Seg info. units_com = 1 'ENable UNITs cathode. Pause 10 'Keep UNITs ON for 10mS before going back to TENS units_com = 0 'DISable UNITs cathode. 'TENS: seg7 = MSB 'place data "MSB" onto PortB 7Seg info. tens_com = 1 'ENable TENs cathode. Pause 10 'Keep TENs ON for 10mS before going back to UNITS tens_com = 0 'DISable TENs cathode. GoSub GetSerial 'Go and check for new serial numbers arriving. GoTo Start 'Repeat this section again, dispaying the 7-Seg data etc. '-----[ END ]-----------------





Bookmarks