Using FullDuplexSerial to receive data via USB
I'm trying to write a program for the P1 that will allow the P1 to receive serial data via the USB port from a python program being run on the connected computer. The purpose is to broaden the functionality of automated testing that is typically done with a python program using pyserial. So I'm essentially trying to get the P1 to act like a bit whacker/banger. I'm currently using FullDuplexSerial but am having some trouble with it.
The code I'm using is below. I'll keep researching/experimenting, but if anyone has suggestions, I'd appreciate it.
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 RST = 15 'OLED pins DC = 16 CS = 17 CLK_oled = 18 DIN = 19 clk_enc = 28 'Encoder pins dt = 29 btn = 11 LED0 = 3 'pins LED1 = 4 LED2 = 5 LED3 = 6 LED4 = 7 LED5 = 8 LED6 = 9 LED7 = 10 Rx = 31 'Serial pins Tx = 30 LE = 2 'latch pin CLK_FREQ = (_clkmode >> 6) * _xinfreq MS_001 = CLK_FREQ / 1_000 'USB is on COM3 OBJ serial : "FullDuplexSerial" VAR long Data long DataX PUB Main serial.Start(Rx, Tx, %0000, 9600) repeat Data := serial.Rx ifnot DataX == Data outa[LED0] := (Data & %00000001) outa[LED1] := (Data & %00000010) >> 1 outa[LED2] := (Data & %00000100) >> 2 outa[LED3] := (Data & %00001000) >> 3 outa[LED4] := (Data & %00010000) >> 4 outa[LED5] := (Data & %00100000) >> 5 outa[LED6] := (Data & %01000000) >> 6 outa[LED7] := (Data & %10000000) >> 7 DataX := Data