-
Serout -->>> serin
I HAVE SOME PROBLEM....
I DONT KNOW WHY MY SEVEN SEGMENT COUNT 1,3,5,7,9
MY CODE:
SEROUT:
I VAR BYTE
TRISD = 0
PORTD = 0
LOOP1:
GOSUB SEND
I = I + 1
PAUSE 200
IF I > 9 THEN
I = 0
ENDIF
GOTO LOOP1
SEND :
SEROUT2 PORTD.1,16468,["A",DEC I]
RETURN
END
SERIN:
INCLUDE "modedefs.bas"
PATTERN VAR BYTE
I VAR BYTE
DIGIT VAR BYTE
TRISC = 255
PORTC = 0
TRISB = 0
PORTB = 0
MAIN:
DIGIT = I
GOSUB CONVERT
PORTB = PATTERN
SERIN2 PORTC.3,16468,[WAIT("A"),DEC I]
GOTO MAIN
CONVERT:
LOOKUP DIGIT, [$C0, $F9, $A4, $B0, $99, $92, $82, $F8, $80, $90], Pattern
RETURN
END
-
Hi larzazral,
With SERIN2, the DEC modifier needs a non-numeric character to indicate the end of the number.
Or, it needs to know how many digits to expect.
As it is, the next non-numeric character is the "A" from the next packet, so that A (and it's data) are discarded, and it waits for the packet after that.
Which makes it only receive every other packet.
Either this on the transmit side ...
Code:
SEROUT2 PORTD.1,16468,["A",DEC I,";"]
OR, this on the receive side ...
Code:
SERIN2 PORTC.3,16468,[WAIT("A"),DEC1 I]
Should get you going.