MikroBasic Pro PIC32 USB Port TXD, RXD.

General discussion on mikroBasic PRO for PIC32.
Post Reply
Author
Message
Skyfall
Posts: 32
Joined: 06 Aug 2017 16:31

MikroBasic Pro PIC32 USB Port TXD, RXD.

#1 Post by Skyfall » 17 Dec 2019 12:33

Hi,

Trying to Send and Receive ASCII characters using the USB port on a PIC32MX470F512H, and MicroBasic for PIC32.

Have tried this example code:

dim cnt,kk as char
dim readbuff as byte[64]
dim writebuff as byte[64]

main:
CHECON = 0x32
AD1PCFG = 0xFFFF
HID_Enable(@readbuff,@writebuff)

while TRUE
USB_Polling_Proc() ' Call this routine periodically
kk = HID_Read()
if (kk <> 0) then
for cnt=0 to 63
writebuff[cnt]=readbuff[cnt]
next cnt
HID_Write(@writebuff,64)
end if
wend
end.

Compiler has issues with this line (identifier not declared) - AD1PCFG = 0xFFFF.

Does anyone have any suggestions - or better example code?

Thank you!

David.

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: MikroBasic Pro PIC32 USB Port TXD, RXD.

#2 Post by phil31 » 17 Dec 2019 21:18

check if AD1PCFG is a register in your device !

regards

Skyfall
Posts: 32
Joined: 06 Aug 2017 16:31

Re: MikroBasic Pro PIC32 USB Port TXD, RXD.

#3 Post by Skyfall » 18 Dec 2019 14:19

No - AD1PCFG was not a valid register for the PIC32MX470F512H.

Does anyone have example code for read/writing data from the USB port?
Thanks for your help!

David.

phil31
Posts: 348
Joined: 02 Apr 2009 15:02
Location: France
Contact:

Re: MikroBasic Pro PIC32 USB Port TXD, RXD.

#4 Post by phil31 » 18 Dec 2019 14:33

the example is working (i already use HID from an old design), just adapt the configuration to your target !

regards

Post Reply

Return to “mikroBasic PRO for PIC32 General”