Getting Data from Serial

Post

Posted
Rating:
#26
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
Man things gets complicate quickly.

Anyone willing to write me the module give me a quote for doing this :)
Online now: No Back to the top

Post

Posted
Rating:
#27
Avatar
Enthusiast
GrayGhost is in the usergroup ‘Enthusiast’
This thread has gotten so convoluted That I don't think anyone can follow it .( at least I can't )

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  :)
Online now: No Back to the top

Post

Posted
Rating:
#28
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
I don't think it's that hard.
The algorithm would seem to be
  1. sent the status request to the printer. That should, AFAICT according to ANdy's manual quotes, to get the drawer state
  2. wait for the response, which as Andy has seen is a single byte!
  3. get the byte
  4. 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
best of luck
thatbruce

Online now: No Back to the top
1 guest and 0 members have just viewed this.