rubisharmax
- 29th May 2012, 17:07
Hi,
I'm using the following code to send data over USB which I learned from this thread: http://www.picbasic.co.uk/forum/showthread.php?t=5806
(http://www.picbasic.co.uk/forum/showthread.php?t=5806)DEFINE OSC 48
(http://www.picbasic.co.uk/forum/showthread.php?t=5806)
Buffer VAR BYTE[1]
Cnt VAR BYTE
counter VAR WORD
ADCON1 = 15 ' Set all I/Os to Digital
CMCON = 7 ' Disable Comparators
Cnt = 1
USBInit ' Initialize USART
' Main Program Loop
Loop:
USBService ' Must service USB regularly
Buffer(0)=50
USBOut 3, Buffer, Cnt, loop
Buffer(0)=60
USBOut 3, Buffer, Cnt, loop
goto loop
end
(http://www.picbasic.co.uk/forum/showthread.php?t=5806)
I check the received data on HyperTerminal but it only shows getting "2"s which means that Buffer[0] is always 50 and never takes the value 60. Could you help me with this problem please, what's the problem in my code? It's supposed to send 50 and 60 in an alternating pattern which correspond to "2" and "<" according to ASCII table.
Regards
I'm using the following code to send data over USB which I learned from this thread: http://www.picbasic.co.uk/forum/showthread.php?t=5806
(http://www.picbasic.co.uk/forum/showthread.php?t=5806)DEFINE OSC 48
(http://www.picbasic.co.uk/forum/showthread.php?t=5806)
Buffer VAR BYTE[1]
Cnt VAR BYTE
counter VAR WORD
ADCON1 = 15 ' Set all I/Os to Digital
CMCON = 7 ' Disable Comparators
Cnt = 1
USBInit ' Initialize USART
' Main Program Loop
Loop:
USBService ' Must service USB regularly
Buffer(0)=50
USBOut 3, Buffer, Cnt, loop
Buffer(0)=60
USBOut 3, Buffer, Cnt, loop
goto loop
end
(http://www.picbasic.co.uk/forum/showthread.php?t=5806)
I check the received data on HyperTerminal but it only shows getting "2"s which means that Buffer[0] is always 50 and never takes the value 60. Could you help me with this problem please, what's the problem in my code? It's supposed to send 50 and 60 in an alternating pattern which correspond to "2" and "<" according to ASCII table.
Regards