Serial Communication
Okay so i want to be able to use a barcode reader for a project; seeing as i had one of those CueCat thing lying around the shop i decided that i was gonna use that.
So i found this wealth of information at www.sujal.net/tech/declaw/ and in particular this part:
The problem is no matter how hard I try i cant get the dam thing to read beyond 8 bits of data. Am i barking up the wrong tree? or is my code a pile of noob sauce that needs some lovin?
N00b sauce starts here:
' {$STAMP BS2sx}
' {$PBASIC 2.5}
INPUT 0
info VAR Word
info1 VAR Word
info2 VAR Word
info3 VAR Word
info4 VAR Word
info5 VAR Word
info6 VAR Word
info7 VAR Word
info8 VAR Word
'info VAR Byte(16)
'info1 VAR Byte(16)
'info2 VAR Byte(16)
'info3 VAR Byte(16)
'info4 VAR Byte(16)
'info5 VAR Byte(16) ' these dont work just there for copying purposes
'info6 VAR Byte(16)
'info7 VAR Byte(16)
'info8 VAR Byte(16)
DO
SERIN 0,500, [noparse][[/noparse] info ]
SERIN 0,500, [noparse][[/noparse] info1 ]
SERIN 0,500, [noparse][[/noparse] info2 ]
SERIN 0,500, [noparse][[/noparse] info3 ]
SERIN 0,500, [noparse][[/noparse] info4 ]
SERIN 0,500, [noparse][[/noparse] info5 ]
SERIN 0,500, [noparse][[/noparse] info6 ]
SERIN 0,500, [noparse][[/noparse] info7 ]
SERIN 0,500, [noparse][[/noparse] info8 ]
DEBUG CR, HEX info
DEBUG CR, HEX info1
DEBUG CR, HEX info2
DEBUG CR, HEX info3
DEBUG CR, HEX info4
DEBUG CR, HEX info5
DEBUG CR, HEX info6
DEBUG CR, HEX info7
DEBUG CR, HEX info8
PAUSE 1500
DEBUG CR,"GO",CR
LOOP
it was alot smaller earier but i dont feel like editing it; the only reason i added more info variables was to try and see if there was more communication that i wasn't seeing
when i run this and swipe a barcode the only thing that come up is this
FD
FD
FD
FD
FD
FD
FD
FD
FD
GO
before i rant too much more with this post i must say that i did try to import a single variable " info VAR byte(26) "
but it also didn't give much more then what having 8 did
Any ideas are welcome
-Matt
So i found this wealth of information at www.sujal.net/tech/declaw/ and in particular this part:
Somebody said...
So, the microcontroller reads in a total of 9 16-bit words from addresses 0x01 through 0x09 (I have no idea why they didn't start at 0x00). Note that in this sample scan
.C3nZC3nZC3nYCNr2C3fWCNnY.fHmc.C3DZCxPWCNzWDNnX.
000000001175023101 UPA 040293153502
The problem is no matter how hard I try i cant get the dam thing to read beyond 8 bits of data. Am i barking up the wrong tree? or is my code a pile of noob sauce that needs some lovin?
N00b sauce starts here:
' {$STAMP BS2sx}
' {$PBASIC 2.5}
INPUT 0
info VAR Word
info1 VAR Word
info2 VAR Word
info3 VAR Word
info4 VAR Word
info5 VAR Word
info6 VAR Word
info7 VAR Word
info8 VAR Word
'info VAR Byte(16)
'info1 VAR Byte(16)
'info2 VAR Byte(16)
'info3 VAR Byte(16)
'info4 VAR Byte(16)
'info5 VAR Byte(16) ' these dont work just there for copying purposes
'info6 VAR Byte(16)
'info7 VAR Byte(16)
'info8 VAR Byte(16)
DO
SERIN 0,500, [noparse][[/noparse] info ]
SERIN 0,500, [noparse][[/noparse] info1 ]
SERIN 0,500, [noparse][[/noparse] info2 ]
SERIN 0,500, [noparse][[/noparse] info3 ]
SERIN 0,500, [noparse][[/noparse] info4 ]
SERIN 0,500, [noparse][[/noparse] info5 ]
SERIN 0,500, [noparse][[/noparse] info6 ]
SERIN 0,500, [noparse][[/noparse] info7 ]
SERIN 0,500, [noparse][[/noparse] info8 ]
DEBUG CR, HEX info
DEBUG CR, HEX info1
DEBUG CR, HEX info2
DEBUG CR, HEX info3
DEBUG CR, HEX info4
DEBUG CR, HEX info5
DEBUG CR, HEX info6
DEBUG CR, HEX info7
DEBUG CR, HEX info8
PAUSE 1500
DEBUG CR,"GO",CR
LOOP
it was alot smaller earier but i dont feel like editing it; the only reason i added more info variables was to try and see if there was more communication that i wasn't seeing
when i run this and swipe a barcode the only thing that come up is this
FD
FD
FD
FD
FD
FD
FD
FD
FD
GO
before i rant too much more with this post i must say that i did try to import a single variable " info VAR byte(26) "
but it also didn't give much more then what having 8 did
Any ideas are welcome
-Matt
Comments
scaned var byte(16)
i var byte
serin MyPin, SetBaud, [noparse][[/noparse]str scaned\16] ' this get 16 bytes of data into the variable Scaned
for i=0 to 15
debug hex2 scaned(i), CR
next
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Smile ... It increases your face value!
Post Edited (MrBi11) : 2/6/2009 10:37:48 AM GMT