PUBLIC com3TXQueue(1 to 32) as Byte
PUBLIC com4RXQueue(1 to 100) as Byte
PUBLIC CONST com3tx_pn as Byte = 15
PUBLIC CONST com4rx_pn as Byte = 14
Sub Main()
'setup software coms
Call ComChannels(2, 9600)
'OPEN COM3 - for lcd
Call OpenQueue(com3TXQueue, SizeOf(com3TXQueue))
Call DefineCom(3, 0, com3tx_pn, &H08)
Call OpenCom(3, 9600, 0, com3TXQueue)
'OPEN COM4 - for rfid
Call OpenQueue(com4RXQueue, SizeOf(com4RXQueue))
Call DefineCom(4, com4rx_pn, 0, &H80)
Call OpenCom(4, 9600, com4RXQueue, 0)
Do
if GetQueueCount(com4RXQueue) > 0 then
Debug.print GetQueueStr(com4RXQueue)
end if
Call Sleep(0.1)
Loop
sturgessb wrote:But I have uninstalled the IDE and installed latest 3.0.2 version, and getting the same problem.
If you do only that, you will indeed continue to have the same problem. Note that the correction for the inverted mode problem is present only in the ZX Library v3.0.5 and later. The ZX Library that gets installed with the current installer is v3.0.4. We didn't update the installer because we thought that we would have a new release sooner than we've been able to.
The special ZX Library update is the fifth entry on the Downloads Page. Just download the .zip file and extract the files to the zxlib subdirectory of the ZBasic installation directory.
for sanity sake (to check i didnt have a bad pin etc) i changed the opencom to be non-inverted. So you know, this works, so its definitely the problem.
sturgessb wrote:So you know, this works, so its definitely the problem.
Thanks for devising this test.
I rebuilt the ZX Library and verified that the updated SW UART code was re-compiled for the ZX-128ne (and all other devices as well). I posted this as v3.0.6 just to avoid any confusion. Download that, extract it to the ZBasic/zxlib subdirectory and see if that rectifies the problem.
sturgessb wrote:Call DefineCom(4, com4rx_pn, 0, &H80) does not
If that's actually the value you're using for the fourth parameter then that is the problem - it should be &H88 for inverted, 8-bit. The only two legal values for the least significant four bits are 7 and 8; all other values result in silent failure.
sturgessb wrote:i thought 8 bit was standard and therefore didnt need to be specified.
Just to be clear, the "Serial Channel Configuration Flag Values" table in the description of DefineCom() describes several fields which can be combined to get the desired effect. The value &H08 means "non-inverted, no parity, 8-bit" while the value &H88 mean "inverted, no parity, 8-bit".
This same concept is used in the description of bit fields for several ZBasic System Library routines including DefineX10(), ShiftInEx(), ShiftOutEx(), etc.
I should have known that, school boy error. Its a bugger we didnt spot that error in my code in first post.
When i change it to &H88 i just get giberish so i have no bloody idea whats going on, the spec sheet for the rfid must be wrong as i get a correct value when set to non-inverted
However, it doesnt matter, the value is the same everytime, and thats whats important, so I dont want to waste any more of your time.