PDA

View Full Version : pic 12F683 question



Bouif2
- 29th January 2010, 12:32
Hello,
Tanks to tell me why GPIO pins 5, 4 and 1 has no reaction with this instructions.




' Áp used : 12F683

include "modedefs.bas"
DEFINE LOADER_USED 1 '
define OSCAL_2K 1 ' define oscal for 2 k devices
DEFINE OSC 4 ' Oscillator speed in MHz: 3(3.58) 4 8 10 12 16 20 24 25 32 33 40
'----------------------------------------------------------------------
ANSEL=0
TRISIO =0

start:
low 5
low 4
low 2
low 1
low 0
pause 1000
high 5 ' no reaction
high 4 ' no reaction
high 2 'ok
high 1 no reaction
high 0 'ok
pause 1000
goto start

mackrackit
- 29th January 2010, 12:47
Try


HIGH GPIO.5
PAUSE 1000
LOW GPIO.5
PAUSE 1000

Acetronics2
- 29th January 2010, 13:01
Ok,

The answer is on page 24 & 30 of the manual ( v 2.60 ...)

instead of



include "modedefs.bas"


use


include "bs2defs.bas"


Alain

Bouif2
- 29th January 2010, 15:39
Thanks for the answer.
But there is no evolution when i use
HIGH GPIO.5
PAUSE 1000
LOW GPIO.5
PAUSE 1000

GPIO 4 and 5 still inactive

A other suggestion ?
Regards.
Bouif2

Bouif2
- 29th January 2010, 16:00
I tested and the
use of "include "bs2defs.bas"" did not bring live to the pins.
Some other idea.?

mackrackit
- 29th January 2010, 16:11
Now that I look at the data sheet I see GPIO.4 is analog.
So add

ANSEL = 0
Near the beginning of your code. That will make all pins digital.

Other than that I do not see a problem.

How are your configs set and how is it wired?

Bouif2
- 29th January 2010, 16:17
Thanks Dave for your anwer.
But " ANSEL = 0 " did not bring a amelioration.
Regards.
Bouif2

Acetronics2
- 29th January 2010, 16:21
Yes ...

a ( working ...) typical 12F683 INTOSC Header ...




@ __config _INTRC_OSC_NOCLKOUT &_FCMEN_OFF &_IESO_OFF & _WDT_ON &_PWRTE_ON & _MCLRE_OFF & _CP_OFF

OSCCON = %01110111 ' Internal Clock 8 Mhz

CMCON0 = 7
VRCON = 0
ADCON0 = 0
ANSEL = 0



and NO "Define Osccal" to write ...

You have some LOTS OF good reading to do, this evening ... BEFORE sleeping.

Alain