So I am using this section of code, and I get my start variable (x) and 0-9 ascii just fine, but i need to be able to get like 0-1024 number , i get i will need to take out the "rxbyte -48" part but how do i get the extra bytes, and combine them to a number between 0-1024?
start:
;Pic waits for signal from terminal/computer
RCV_RS232 ;Waits for terminal input, and return value is RxByte
if RxByte = 120 then 'x axis
RCV_RS232
RxByte = RxByte - 48
Sub RCV_RS232
RxWait:
IF SerRx On Then goto RCV_RS232 ;wait for start bit
wait halfbaud us ;do half bit time delay
If SerRx On Then goto RxWait
RxByte = 0
For RxBit = 1 to 8 ;set up to read 8 bits
wait baud us
Rotate RxByte Right
If SerRx On then Set RxByte.7 1
If SerRx Off Then Set RxByte.7 0
Next wait baud us
End sub
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So I am using this section of code, and I get my start variable (x) and 0-9 ascii just fine, but i need to be able to get like 0-1024 number , i get i will need to take out the "rxbyte -48" part but how do i get the extra bytes, and combine them to a number between 0-1024?
start:
;Pic waits for signal from terminal/computer
RCV_RS232 ;Waits for terminal input, and return value is RxByte
if RxByte = 120 then 'x axis
RCV_RS232
RxByte = RxByte - 48
Sub RCV_RS232
RxWait:
IF SerRx On Then goto RCV_RS232 ;wait for start bit
wait halfbaud us ;do half bit time delay
If SerRx On Then goto RxWait
RxByte = 0
For RxBit = 1 to 8 ;set up to read 8 bits
wait baud us
Rotate RxByte Right
If SerRx On then Set RxByte.7 1
If SerRx Off Then Set RxByte.7 0
Next wait baud us
End sub
Here is a discussion on how to use an interrupt and the hardware serial receive routines.
https://sourceforge.net/projects/gcbasic/forums/forum/579126/topic/5002969
The procedure should work in a similar fashion for the software uart routine.
By sending an EOT, or end of transmission character from the terminal, the micro could then determine when to evaluate the incoming variable.