Where should this go?
I cut'n'pasted from the above code section, into microcodestudio, then added this to the top, before the define
Code:
' **************************** Added from other demo
buffer Var Byte[16]
cnt Var Byte
LED Var PORTB.0
Define OSC 48
'****************************************************
high led
Then at the bottom after overusbservice I added the usb in/out and a led flash to show its alive
Code:
idleloop:
low led
pause 500
high led
pause 500
cnt = 16 ' Specify input buffer size
USBIn 3, buffer, cnt, idleloop
' Message received
buffer[0] = "H"
buffer[1] = "e"
buffer[2] = "l"
buffer[3] = "l"
buffer[4] = "o"
buffer[5] = " "
buffer[6] = "W"
buffer[7] = "o"
buffer[8] = "r"
buffer[9] = "l"
buffer[10] = "d"
buffer[11] = 13
buffer[12] = 10
buffer[13] = 0
outloop:
USBOut 3, buffer, 14, outloop
Goto idleloop ' Wait for next buffer
usbinit and usbservice was removed from the code of the other demo like it says to.
It looks to me like a worker, but i get compile errors, lots of them
This one
Code:
IDLEIF VAR UIR.4 ; USB Idle Interrupt Flag
<
gives me a bad datatype (first of a few)
and this one
Code:
UIE = $7F ; enable USB interrupts
throws up a syntax error with some more below it
I tried it as
INCLUDE "USB_ASM_Service"
At the top of my little test and MCS opened it as a 2nd page, and threw up the same errors.
Just for completeness thats here
Code:
include "USB_ASM_Service.pbp"
' **************************** Added from other demo
buffer Var Byte[16]
cnt Var Byte
LED Var PORTB.0
Define OSC 48
' ****************************************************
high led
idleloop:
low led
pause 500
high led
pause 500
cnt = 16 ' Specify input buffer size
USBIn 3, buffer, cnt, idleloop
' Message received
buffer[0] = "H"
buffer[1] = "e"
buffer[2] = "l"
buffer[3] = "l"
buffer[4] = "o"
buffer[5] = " "
buffer[6] = "W"
buffer[7] = "o"
buffer[8] = "r"
buffer[9] = "l"
buffer[10] = "d"
buffer[11] = 13
buffer[12] = 10
buffer[13] = 0
outloop:
USBOut 3, buffer, 14, outloop
Goto idleloop ' Wait for next buffer
Bookmarks