I run into same issue, again. I needed to create full serial port emulator, like FT232, and to do some other things with pic.
I spent almost a week, trying to get C to work, and decided to give PBP another try.
This time with good result.
To get baud rate, parity and stop bits from original CDC demo, use this code
Code:BaudRate var long BANKA SYSTEM StopBits Var Byte BANKA SYSTEM ;0=1 stop bit, 2=2 stop bit ParityType Var Byte BANKA SYSTEM DataBits Var Byte BANKA SYSTEM Main: ' original code from CDC example GOSUB GetLineCoding 'get baudrate etc... Should do that regularly and check if anything is changed GetLineCoding: asm movlb high _USBMEMORYADDRESS ; Point to proper bank movf line_coding + dwDTERate, W movwf BaudRate movf line_coding + dwDTERate + 1, W movwf BaudRate + 1 movf line_coding + dwDTERate + 2, W movwf BaudRate + 2 movf line_coding + dwDTERate + 3, W movwf BaudRate + 3 movf line_coding + bCharFormat, W movwf StopBits movf line_coding + bParityType, W movwf ParityType movf line_coding + bDataBits, W movwf DataBits endasm RETURN




Bookmarks