hi jj,
I did say that I was not sure if 'camerart' is using signed or unsigned values.
Oshonsoft does not support signed WORD values.
I assumed that the '16 bit counter' POSCNT, in the 18F2431 PIC would roll down thru .... 1,0,65535, 65534.....
It is possible to preload the CAP2CNT registers with 3599 [359.9 deg] decimal., as was done in the earlier programs I posted, which all work on my hardware.
Perhaps the OP will clarify that point.
E
Hi Eric,
Just to clarify! IMPORTANT!! What was:
CAP2BUFL = 0x00 'POSCNT from quad signals, preload L0000
CAP2BUFH = 0x00 'POSCNT from quad signals, preload H0000
CAP3BUFL = 0x0f 'MAXCNT, preload with 3599 degrees [actual 359deg][
Should read 359.9deg]
CAP3BUFH = 0x0e 'MAXCNT, preload with ???? degrees [actual ???deg]
Is now:
CAP2BUFL = 0x00 'POSCNT from quad signals, preload L0000
CAP2BUFH = 0x00 'POSCNT from quad signals, preload H0000
CAP3BUFL = 0x0f 'MAXCNT, preload with
3581 degrees
[360deg - 0.995Deg]
CAP3BUFH = 0x0e 'MAXCNT, preload with ???? degrees [actual ???deg]
Due to the recently found error of the 100:1 gearbox being actually 99.5:1. Therefore
3582 steps/rev of the output shaft.
I'm not familar with signed and unsigned values, but if this means that there are negatives, then no I don't use signed values. I hope this is correct!
I was interested in the code in post #1, with the 'Distance.15' variable, as I've not come across this before, especially if it gives better code than before. Also if it allows me to add a DEADBAND succesfully.
C.