If I measure the output of an encoder chip on an oscilloscope (or sound card), how can I replicate the timing and pulses? The datasheets for the encoder (http://www.mosdesign.com.tw/datashee...coder/dM1E.PDF) shows the timing and encoder sequence.
If I measure the output of an encoder chip on an oscilloscope (or sound card), how can I replicate the timing and pulses? The datasheets for the encoder (http://www.mosdesign.com.tw/datashee...coder/dM1E.PDF) shows the timing and encoder sequence.
So, what's the problem?
You have the datasheet for the IC in question...
You have an o-scope to measure the output from the example chip that...
You have in your possession to compare with the circuit that you will build and program.
Again, what's the issue here?
Show us any/all code you have written so far, and most surely, somebody here could help you make it work.
When I wrote the code like this and individually went through each 0 and 1 bits it outputted fine on the pin
start:
low fan_tx
PulsOut Fan_tx, 35
pauseus 330
pulsout fan_tx, 66
pauseus 660
pulsout fan_tx, 33
pauseus 330
pulsout fan_tx, 66
pauseus 330
pulsout fan_tx, 66
pauseus 660
pulsout fan_tx, 33
pauseus 660
pulsout fan_tx, 33
pauseus 660
pulsout fan_tx, 33
pauseus 660
pulsout fan_tx, 33
pauseus 660
pulsout fan_tx, 33
pauseus 660
pulsout fan_tx, 33
pauseus 660
pulsout fan_tx, 33
pauseus 330
pulsout fan_tx, 66
pauseus 100
goto start
Now when I try to simplify it, I'm not getting any output with the following code from PORTD.5:
RF VAR bit[12]
c VAR byte 'number of times to send data stream (loop)
b VAR byte 'RF(b) stream (loop)
Output_TX VAR PORTD.5
Main:
'lead-in pulse of 350uS followed by
'Data to output: 010011111110
RF[0]=0
RF[1]=1
RF[2]=0
RF[3]=0
RF[4]=1
RF[5]=1
RF[6]=1
RF[7]=1
RF[8]=1
RF[9]=1
RF[10]=1
RF[11]=0
Low Output_TX
For c = 1 To 4 'number of times to send data stream
PulsOut Output_TX, 35 '350uS lead-in pulse
For b = 0 To 11
If RF[b] = 0 Then
PauseUs 330 '330uS space
PulsOut Output_TX, 66 '660uS pulse
Else
PauseUs 660 '660uS space
PulsOut Output_TX, 33 '330uS pulse
EndIf
Next
Pause 40 '40mS GAP in between each copy
Next
Sleep 2 'Wait 2 seconds before sending data again
GoTo Main
Am I missing something here?
Might help to put the variable that you are NEXTing in your NEXT statements...and set the pin that you are using to an output before you use it.Code:RF VAR word : c VAR byte : b VAR byte : output_TX VAR PORTD.5 output output_tx Main: RF=$7f2 : Output_TX = 0 : For c = 1 To 4 : PulsOut Output_TX, 35 For b = 0 To 11 If RF.0[b] = 0 Then PauseUs 330 : PulsOut Output_TX, 66 '660uS pulse Else PauseUs 660 : PulsOut Output_TX, 33 '330uS pulse EndIf Next b : Pause 40 : Next C : Sleep 2 : GoTo Main
(The high colonic master strikes again!)
Last edited by skimask; - 12th May 2008 at 17:36.
Bookmarks