what do i do wrong?


Closed Thread
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    Les Angles (FRANCE)
    Posts
    18

    Talking what do i do wrong?

    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?
    Jean-François

    F4CDH

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Add this line at the top of your 12F508 code, before the TRIS line.
    Code:
    OPTION_REG.5=0
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2004
    Location
    Les Angles (FRANCE)
    Posts
    18


    Did you find this post helpful? Yes | No

    Thumbs up

    it work fine now!

    thanks a lot

    merci beaucoup et bonjour de france
    Jean-François

    F4CDH

Similar Threads

  1. LCD Showes Some Wrong Letters
    By sbobowski in forum General
    Replies: 2
    Last Post: - 23rd September 2008, 19:15
  2. Anyone know whats wrong with this code
    By Bonxy in forum Serial
    Replies: 10
    Last Post: - 9th March 2007, 16:29
  3. ADCIN - AD settings are wrong
    By teverett in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th December 2006, 16:32
  4. What am I doing wrong?
    By mankan in forum General
    Replies: 1
    Last Post: - 23rd June 2006, 19:03
  5. HDD IDE ATA 2 interface problems. code wrong?
    By rastan in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 27th March 2005, 16:01

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts