Quote Originally Posted by BillTodd View Post
It sounds to me like the vernier is not being set to fast mode correctly my the PIC. and it is mis-reading the vernier as a binary version rather than a BCD type.

Fire up a serial comms package or hyperterminal, if ALL else fails :)

Set baud to 115,200, 8, n,1

Send 'i0' and the PIC (in position X) should respond with something.

;command line interpretor
;Commands: (case insensitive)
;rx - Read - reads and transmits abs position (x=x,y,z,w)
;sn - Sets sample rate (n=0,1,2) 0 =poll mode, 1 = 300mS (normal), 2 = 20mS (fast mode)
;zx - zero vernier display (x=x,y,z,w)
;vn - set vernier type (n=0,1) 0 = old, 1=decimal


send V1 to set decimal vernier, then S0 to set poll mode, then RX and the pic should respond with X00.000: (inches) or X000.00:
(mm). If it returns XH000000: then it is not reading the vernier as a decimal type.

I have one vernier here that has a similar problem , so if I can fine the time I'll look into it. In the mean time, you could try inserting an extra pulse clk in the setfast routine

Code:
setFaut bsf Mode,Auto
setFast bsf Mode,Fast
clrwdt
call zeronorm
clrwdt ;pulse clk again if decimal type
call Dly200
call Plsdata
btfss Mode,Vtype 
return
clrwdt ;pulse clk again if decimal type
call Dly200
call Plsclk
call Dly200 ;exta pulse clk *******
call Plsclk
call txZero ;send zero message
return
A quick PIC to PC test:

disconnect serial lead from PC , disconnect vernier from PIC

Run VB application, select correct comm port

Connect serial lead, connect vernier to PIC - you should see a new frame appear for X, Y, Z or W - if this happens the serial port is working OK.

you should see the vernier be reset to zero then depending on type H (for hold) and F (for fast)

Press ZERO (and hold) on the vernier, this will stop the clock signal, after a second or less the PIC will signal the PC to remove the frame .

Releasing the zero will start the clock, the PIC will signal the PC and the PC will issue a reset to the Vernier.


If all of the above works the serial comm must be working fine.
Thanks Bill,

I'll try all that, its all very usefull info.

As I say in the word attachment I also have another vernier I can try and that one has the abs and rel 24bit packet output format. I'll wire that in first to try, then I'll try to adjust the asm code as you suggest for the BCD version.

What confuses me slightly is the need to run the vernier in fast mode. I thought this is just the update rate and should not cause corruption of the data. I know it is good to get the 40 updates per second for real use on the Mill or Lathe but for test purposes does it matter?

Cheers,