Hi!
I want todo a small program to print to my com Printer
This is the printer i have:
Epson TM-U210
baudrate: 9600
parity:none
data_bits:8
stop_bits:1
Protocol:RTS/CTS
sequence to open Money Drawer:27,112,0,48,0,48
I want to be able to Open the Drawer and to print text into the paper, also feed out paper ( println )
Thanks in advance!
How do i print to my com printer?
This example should work.
Code: Select all
dim as integer total = 5.97
open com "com1:9600,n,8,1,cd0,ds0" as #1 'change port if needed
if err then
print "error opening port"
sleep
end
end if
sleep 500
print #1,chr$(27);chr$(112);chr$(0);chr$(48);chr$(0);chr$(48);
sleep 500
print #1,"Total purchase $";
print #1,using "###.##";total
sleep
Wow thank's, i have been messing with Open com but was not able to get it to work, now i understand what i was doing wrongphishguy wrote:This example should work.
Code: Select all
dim as integer total = 5.97 open com "com1:9600,n,8,1,cd0,ds0" as #1 'change port if needed if err then print "error opening port" sleep end end if sleep 500 print #1,chr$(27);chr$(112);chr$(0);chr$(48);chr$(0);chr$(48); sleep 500 print #1,"Total purchase $"; print #1,using "###.##";total sleep
Just a small question...
This code would also work in linux too or it is just windows, if yes do i still use COM1 or i use the linux port name?
Darn, I guess that's not on the doc pages.
"COM:" should map to "/dev/modem"
"COM1:" should map to "/dev/ttyS0"
"COM2:" should map to "/dev/ttyS1", etc
"/dev/whatever:" is unchanged.
So "COMn:" should be the cross platform compatible version. But if you test the other variations also, and they don't work, please let us know.
"COM:" should map to "/dev/modem"
"COM1:" should map to "/dev/ttyS0"
"COM2:" should map to "/dev/ttyS1", etc
"/dev/whatever:" is unchanged.
So "COMn:" should be the cross platform compatible version. But if you test the other variations also, and they don't work, please let us know.
Thank you!!coderJeff wrote:Darn, I guess that's not on the doc pages.
"COM:" should map to "/dev/modem"
"COM1:" should map to "/dev/ttyS0"
"COM2:" should map to "/dev/ttyS1", etc
"/dev/whatever:" is unchanged.
So "COMn:" should be the cross platform compatible version. But if you test the other variations also, and they don't work, please let us know.
I had lots of headaches trying to do this, and it's so damn easy in FreeBasic :)
I am using it already for the app i created for open MoneyDrawer when i click a global shortcut
Its handy
Later i will try to find a way to use it an application i have doe in Java ( maybe using JNI or a single exe that prints from parameters )
Thanks again freebasic!!