Menu

pic 12f510

Chris King
2008-08-17
2013-05-30
  • Chris King

    Chris King - 2008-08-17

    Hello All,
    I'm getting problems with the compile process.  If I change the chip type to 16f819, it compiles properly.  Not sure how to do the dat file thing - anyone got any ideas?  I tried changing the makeasm to MPASM - but still getting the same messages (cannot set direction of individual pins,  missing bit in set command, config setting not valid: OSC=INTRC_OSC)   Anyone got any ideas?
    Thanks Much!
    Chris

     
    • Chris King

      Chris King - 2008-08-17

      By the way... here's the actual compile output... I am fairly new to this process - so I'm not sure what/if I'm doing anything wrong, but the code does seem to compile if CHIP is set to the 16f819.

      Great Cow BASIC (0.9 10/2/2007)

      Compiling C:\Users\Emily\Desktop\New Folder\footlight\pic-test-prog.txt ...
      Errors have been found:

      pic-test-prog.txt (24): Cannot set direction of individual pins on 12 bit
      core chips
      system.h (122): Missing bit in SET command
      system.h (128): Missing bit in SET command
      system.h (129): Missing bit in SET command
      system.h (130): Missing bit in SET command
      Configuration setting not valid: OSC=INTRC_OSC

      The message has been logged to the file C:\PROGRA~1\GCBASIC\ERRORS.TXT.

      Press any key to continue

       
    • kent_twt4

      kent_twt4 - 2008-08-17

      "pic-test-prog.txt (24): Cannot set direction of individual pins on 12 bit
      core chips "

      GCBasic is looking for something like 'dir GPIO b'001000', the 12f510 may not specifically require this, but enough of the other 12 bit devices do.

      "Configuration setting not valid: OSC=INTRC_OSC"

      Using '#config OSC=INTRC_RC' compiles fine.  Suggest you download 'update.zip' located here
      http://gcbasic.sourceforge.net/download.html and drop that in your GCBasic folder.

      After all that, still got an excessive ram usage error on a simple blink Led program.  Kind of odd because my 12f509 compiles fine, and it seems to have a similar memory organization.  The 12f510 has a different sort of file register tho, that might need some more exploration?

      A lot of the kinks have been worked out recently on the 12f675 and 12f683 recently, so if you are looking for an 8 pin device with immediate results?

       
    • kent_twt4

      kent_twt4 - 2008-08-23

      Revisited the ram usage thing, and overlooked the most obvious.  Go to the chipdata folder and click on your 12F510.  Scroll down til you see [FreeRam], yikes!! no registers.  So plug in the following and save to disk.

      [FreeRam]
      10:1F
      30:3F

      Compiles fine now, no more excessive ram usage.  Will issue a bug report.

      Found another bug that could cause a problem.  GCBasic as default set the comparators, and a-d in the off position, so all GPIO's are outputs unless told otherwise.  Find the system.h file in the include/lowlevel/ folder, the first sub is the Initsys sub.  Follow down till you see 'Turn off comarator, and insert lines as seen below, and save to disk.

           'Turn off comparator
          #IFDEF Var(CMCON)
              CMCON = 7
          #ENDIF
      '***********************************
      '12F510,16F506 and other devices?
          #IFDEF Var(CM1CON0)
              #IFDEF Var(CM2CON0)
                  C2ON = 0
              #ENDIF
              C1ON = 0
          #ENDIF
      '***********************************

          #IFDEF Var(CMCON0)
              CMCON0 = 7
          #ENDIF

       
    • kent_twt4

      kent_twt4 - 2008-08-23

      Doh!, rechecked the datasheet and the 12f510 [FreeRam] should be:

      [FreeRAM]
      0A:1F
      30:3F

       
    • Chris King

      Chris King - 2008-08-24

      Thanks for the updates... I've been playing around in ASM land - and was able to get some things to work using the MPASM compiler.  However, I will make some of these changes to see if I can't get the same program working under GC.   Thanks again!  Will post updates when I get them tested out.
      Chris

       
  • Chris King

    Chris King - 2009-12-10

    Hello Again,
       I am still working on a pic12f510.  I've spent some time writing applications in ASM and it's been good and educational - but I'd still like to get GC going.  I decided to do a little test - I took the blinkLED program, changed the chip to 12f510, and changed the ports to GP1 and compiled the program - it compiled - I flashed the pic - but the blink doesn't happen.  I got no errors.  Any ideas?  I thought it might be related to setting the analog and comparator functions to off - so I included inline code - but still didn't work.
    Thoughts?
    Thanks,
    Chris

     
  • kent_twt4

    kent_twt4 - 2009-12-10

    Show us your code.  GCBasic does not set the TRIS GPIO register for the baseline chips, as stated in earlier post.  For all digital outputs use:

        dir GPIO b'001000'

     
  • Chris King

    Chris King - 2009-12-10

    I got it!  Apparently, I pulled some old ASM code from a revision that was using a different GP pin from the GP pin I was trying to use!  So, once I figured that out - it started working fine.  Now on to the software PWM function :)

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.