问题
I write Linux application that is supposed to handle coins insertations (let's say that for now I need to recognize in application what coin has been inserted). I use SCA1 Coin Acceptor (ICT). I need to make it work with polish coins (currency - polish zloty). I was able to get the communication between PC and Coin Acceptor to work, but I have some issues.
Quick description of my setup:
- PC connected to Coin Acceptor via RS232 (+USB converter) over the ccTalk protocol.
- Switch Block 1: All OFF, but for the 10th switch, which is set to ON (according to documentation)
- Switch Block 2: All OFF
- I set inhibit status to allow all (from manual docs)
- I set master inhibit status to enable device (from manual docs)
I'm able to pull data from Coin Acceptor regarding serial number, software revision etc. Simple poll works as well. The only issues is with actuall information about inserted coins. I send "Read buffered credit or error codes" (Header 229) command - according to the docs - every 500ms or so, and every time I get result 0 (bytes are equal to 0x00), the result is returned correctly, it just seems like I haven't inserted any coin, when I have. I tried to use polish coins as well as 10 cent coin. All coins are "rejected", and by rejected I mean Coin Acceptor doesn't seem to process those coins (just returns them), on the other hand, when I send command to get the number of rejected coins I get 0, again.
So now question for you, are you aware of any additional setup that is required to get it work (preferabley with polish coins) ? Also, by default (let's say the Coin acceptor is not connected to PC, but is powered) how does the Coin Acceptor should react on inserted coins ? Just returns them (like in my case) or "processes" them and then returns them or puts them into the "bank" ?
I guess there is no point of me posting the code. I've created two different applications, and the issue is the same.
One in python, I took adventage of https://github.com/Baldanos/ccTools, second application is written in C, something like: https://github.com/BitCoding/cctalk.
It's doubtful that the device is broken, because I tried to use other device with no difference. Also, the devices are brand new.
Any suggestions will be helpful. Thank you in advance.
回答1:
I would have written this as a comment but I do not have enough reputation:
I have also used Baldanos' library as a starting point to get my coin acceptor to work. I would first replace
ser.read(50)
with
time.sleep(0.01) #give it time for all bytes to be in ser.in_waiting
ser.read(ser.in_waiting)
Since, as said in the comments, you don't know if the message will be 50 bytes long.
That said, I managed to get it to work without changing too many things. For me, the coin acceptor was already set to Euros. What does your coin acceptor return when you request the coin id's (sending "184" and the range of 1,16)?
来源:https://stackoverflow.com/questions/41680647/cctalk-coin-acceptor-no-reaction-when-coin-inserted