Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I lost it a couple of days ago, so I know what you meanWith all this to-ing and fro-ing I lost the plot!!! camerart Have you the latest full code..
Are you doing this with an actual 12F683 or on the simulator? It works for me also in the simulator, but not in circuit. I've sent Eric some chips to try.At the moment..
AN0 increased to 100... Red LED comes on..
AN1 increased to 100 Green LED comes on..Or....
Red LED flashes according to value of AN0 ( On time )
Red LED flashes according to value of AN1 ( Off time )
AN1 increased to 100... Green LED comes on..
AN0 increased to 100 Red LED comes on.. Red LED flashes according to value of AN0
Red LED flashes according to value of AN0 ( On time )
Red LED flashes according to value of AN1 ( Off time )
If both AN0/1 are lower than 100 then both LED's are off..
This makes no difference if T1CON is on or off...
loop:
'Adcin 0, an0 'Sets first pulse
'Adcin 1, an1 'Sets second pulse
Break
'If an0 >= 100 Then
rled = 1 'ON IN SIMULATOR = OFF
'firstpulse = an0
'WaitMs an0
'firstpulse = 0
'Else
'rled = 0 'OFF IN SIMULATOR = ON
'Endif
'If an1 >= 100 Then
gled = 1 'ON IN SIMULATOR = OFF
'secondpulse = an1
'WaitMs an1
'secondpulse = 0
'Else
'gled = 0 'OFF IN SIMULATOR = ON
'Endif
Goto loop
Stepping through the code from the BREAK command. At 'rled = 1' then RLED turns on, at 'gled' = 1 then GLED turns on and RLED stays on.hi,
Even the IF tests are remmed out the problem shows in simulation.
Camerart, try this.
Rem out as the following lines...
Use the Program Tracking Option.
When it executes the Break , single step thru the code.
rled will become set when the rled=1 statement is executed.
But will reset when you execute the gled=1 statement! this should not happen
Do you follow that OK.?
Code:loop: 'Adcin 0, an0 'Sets first pulse 'Adcin 1, an1 'Sets second pulse Break 'If an0 >= 100 Then rled = 1 'ON IN SIMULATOR = OFF 'firstpulse = an0 'WaitMs an0 'firstpulse = 0 'Else 'rled = 0 'OFF IN SIMULATOR = ON 'Endif 'If an1 >= 100 Then gled = 1 'ON IN SIMULATOR = OFF 'secondpulse = an1 'WaitMs an1 'secondpulse = 0 'Else 'gled = 0 'OFF IN SIMULATOR = ON 'Endif Goto loop
hi camerart,
Using MPLAB, the problem is with your ANSEL
you have ANSEL=47; which makes GP2 analog!
make it ANSEL=43 and retry
ANSEL = %01000011
E
I tried 0x43 and 0x53. Same symptoms on the circuit.camerart !! I simulate in ISIS at full speed.... The code from post #24 doesn't have any "t" variable in the loop so timer 1 isn't doing anything??
What Eric said is correct... ANSEL should be 0x43... or 0x53 ( to increase the aqu time a little...)
Eric will receive the Chips in a day or two, best wait till he's had a go with them.
I've changed the ANSEL.OK, will wait for the PIC's, but that ANSEL was incorrect at 47.
When that circuit is operating correctly, what are you expecting to see on the LED's etc.?? just summarise.
E
eric.... Are you back in the RSA?
??? ANSEL 0x43 there are only two adc inputs....R Eric said:OK, will wait for the PIC's, but that ANSEL was incorrect at 47.
hi C,
If they dont turn up I will buy 6 pieces.
Dont worry about the postage.
E
??? ANSEL 0x43 there are only two adc inputs....
camerart So nothing happens on a real chip.... Usually this is down to osc settings.. The reason I say this is because this is the only thing ISIS doesn't simulate!!
The frequency set to 4Mhz. the INTOCS is INTOSCIO. I chose the chip because of its timing accuracy.You haven't got the frequency set wrong? I mean in the IDE..... The chip has a really accurate internal crystal... Also make sure the INTOSC is set to IO function not clockout...