Getting Data from Serial
Posted
Enthusiast

Anyone willing to write me the module give me a quote for doing this
Posted
Enthusiast

If you were to start a NEW thread and post a page or two of the manual for the printer, (or a link to it ) and your code that you have.
Someone may be inclined to look at it and try to help
Posted
Regular

The algorithm would seem to be
- sent the status request to the printer. That should, AFAICT according to ANdy's manual quotes, to get the drawer state
- wait for the response, which as Andy has seen is a single byte!
- get the byte
- mask it with a set of constants that "check" the bits of interest and set status variables as you want them
Crikey we used to do this all the time back in the good old days when all we had to implement serial printer interfaces was FORTRAN IV.
It's not that hard and in the end eminently readable when you come back to it weeks/months later. Stop thinking about the bits, they are not important.Don't bother about converting it to this that or the other, just understand how "bit maps" work… And and Or
In this case the bitmask for the "Drawer state" commend is to my way of thinking P###F##F where P is the drawer state, # is I don't care and F is some secret known only to the printer.
so
Code
Const $DrawerIn As Byte = Bin(10000000) ' Just to make it easy for the binary freaks
Const $DrawerOut As Byte = Bin(01111111) ' Not even really necessary if you read below
...
' in the test method
If And(MyByte, $DrawerIn) then
$drawerstate = "IN"
else
$drawerstate = "OUT" ' See, if it aint in then it must be out (said the actress to the bishop)
EndIf
etc
thatbruce
1 guest and 0 members have just viewed this.



