i'm trying to do a 1750Hz tone générator on 12c508a and it doesn't work so i reduce the code and test it on 12f683 (with the right fuse!) and it run ok so i test it on 12f508 it doesn't run too.
here are the two test code, i don't understand what i'm doing wrong.
code for 12f508 that doesn't work
Code:
@ device pic12F508, INTRC_OSC, MCLR_OFF,WDT_OFF,PROTECT_OFF
GPIO = %00000000 ' toutes les sorties = low
'CMCON0 = 7 ' Comparateur en mode 'comparator off'
TRISIO = %00001000 ' GP0 à GP5 en sortie sauf GP3
'ANSEL = %00000000 ' entrée analogique off
'WPU = %00000000 ' Pull-ups off
OPTION_REG.6 = 0 ' disable internal pull-ups
'----------------------------------------------------------------
' Déclaration des variables
'----------------------------------------------------------------
'----------------------------------------------------------------
' Déclaration des E/S
'----------------------------------------------------------------
SORTIE var gpio.2
output sortie
'----------------------------------------------------------------
' Initialisation
'----------------------------------------------------------------
low sortie
'----------------------------------------------------------------
' Début de programme
'----------------------------------------------------------------
DEBUT:
high sortie
pauseus 286
low sortie
pauseus 286
goto debut
code for 12f683 that work well
Code:
@ device pic12f683, fcmen_off, ieso_off, intrc_osc, wdt_off
@ device pic12f683, pwrt_on, mclr_off, protect_off
GPIO = %00000000 ' toutes les sorties = low
CMCON0 = 7 ' Comparateur en mode 'comparator off'
TRISIO = %00001000 ' GP0 à GP5 en sortie sauf GP3
ANSEL = %00000000 ' entrée analogique off
WPU = %00000000 ' Pull-ups off
OPTION_REG.7 = 1 ' Disable internal pull-ups
'----------------------------------------------------------------
' Déclaration des variables
'----------------------------------------------------------------
'----------------------------------------------------------------
' Déclaration des E/S
'----------------------------------------------------------------
SORTIE var gpio.2
'----------------------------------------------------------------
' Initialisation
'----------------------------------------------------------------
low sortie
'----------------------------------------------------------------
' Début de programme
'----------------------------------------------------------------
DEBUT:
high sortie
pauseus 286
low sortie
pauseus 286
goto debut
i use 'pauseus' instead of 'freqout' because 'freqout' doesn't work on 12Cxx
can someone help me?
Bookmarks