Page 1 of 1
Help getting status of cash drawer in Gambas
Posted: Monday 17th January 2022 12:05am
by AndyGable
Reference
https://reference.epson-biz.com/modules ... =124#gs_lr
Hi all,
The above page shows how I can get the status of the attached cash drawer on a Epson printer could someone please show me how it would convert into Gambas? I ask as I have a sort of working code in FreeBASIC but I am not sure as to how I can convert it to Gambas code.
Once this has been figure this out then all I need to do is work out how to process the status of the printer it self (that is normally low paper, cover open or offline)
Re: Help getting status of cash drawer in Gambas
Posted: Monday 17th January 2022 2:30pm
by cogier
I have a sort of working code in FreeBASIC but I am not sure as to how I can convert it to Gambas code.
Please post the FreeBASIC code? That may help us to help you, as I suspect no one will have your printer to experiment on.
Re: Help getting status of cash drawer in Gambas
Posted: Tuesday 18th January 2022 7:55am
by AndyGable
cogier wrote: ↑Monday 17th January 2022 2:30pm
I have a sort of working code in FreeBASIC but I am not sure as to how I can convert it to Gambas code.
Please post the FreeBASIC code? That may help us to help you, as I suspect no one will have your printer to experiment on.
Well it seems I do not have working code in FreeBASIC i have looked at all my Code projects and For some reason in the past
I removed the cash drawer support and now I can not find the code I did.
I am looking at my emails to see if I can find the email with the code on but I am sorry at this moment in time I do not have the code
Re: Help getting status of cash drawer in Gambas
Posted: Sunday 23rd January 2022 9:21pm
by AndyGable
I have finally found something from 2012 that was used to test the status of the cash drawer (and I am not sure if it works or not but
it should give a idea of what to do with the Epson code)
Code: Select all
Dim status As String
Open COM "COM1:9600,N,8,1,CD0,CS0,DS0,rs" As #1
Print #1, Chr(10) & Chr(4) & 1
While Loc(1) =0
Sleep 1
Wend
status = Input(Loc(1), 1)
Print Bin(Val(status),8)
If Bit(Val(status), 3) = -1 Then
Print "Kickout connector high"
Else
Print "Kickout connector low"
EndIf
If Bit(Val(status), 4) = -1 Then
Print "Offline"
Else
Print "Online"
EndIf
If Bit(Val(status), 6) = -1 Then
Print "Waiting for Online Recovery"
Else
Print "Not Waiting for Online Recovery"
EndIf
If Bit(Val(status), 7) = -1 Then
Print "Paper fed by button"
Else
Print "Paper not fed by button"
EndIf
Close #1
if i remember right it should get the status from the printer and load it into the location called status and then print this to the screen (example 00000000) this will change depending on the status of the printer (if the cash drawer is open then it
should look something like this 00100000)
I hope this helps someone to point me in the right direction
Re: Help getting status of cash drawer in Gambas
Posted: Monday 24th January 2022 3:50pm
by cogier
You should look at the code already put up for you
here.
From that, you should be able to change the Sport SerialPort command using the details from your earlier code. Have a look in your /dev folder to get the correct name of your serial port.
Further help is available
here.