Clock Question - New to PicBasic


Closed Thread
Results 1 to 4 of 4
  1. #1
    cometboy's Avatar
    cometboy Guest

    Default Clock Question - New to PicBasic

    I just bought a copy of PicBasic ( the cheap model ) and have completed the blinking LED exercise. I'm using the EPIC programmer. I'm having a speed problem though.

    The LED is flashing about an order of magnitude slower than expected (clock problem). So it looks like the clock is set to 400KHz rather than 4MHz.

    I'm using a 16F819 without an external crystal. I'm using the INTRC command in the configuration section of the EPIC software.

    I guess that there is a DEFINE OSC command, but as far as I can tell, its only for PicBasicPro.

    Do I have to add a crystal to the circuit? I wanted to minimize parts count, so that is not an attractive option.

    Do I have to buy the premium Pro program to run my first stupid project? I sure hope not.

    My long term goal is building RGB LED clusters using PIC chips driving a NXP PCA9633 LED driver. All will be done using i2c. I have what I want running using the PicAxe system of chips (18X), but was hoping to migrate to PIC by using PicBasic.

    Thanks.

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    The 819 has the ability to be run at several different clock speeds when using the internal oscillator option. Did you set up the OSCCON register? If not, take a look at the 16F819 data sheet, section 4 for details. Post back if you need more information.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

  3. #3
    cometboy's Avatar
    cometboy Guest


    Did you find this post helpful? Yes | No

    Default Got It

    Paul,

    I got some time to look around following your advice, searched to forums for OSCCOM. Quikly found out that it was a non-PicBasic command.

    A hour searching the 16F819 data sheet got me the command, the address and the register description.

    The command POKE $8F, %01100000 got me 4MHz and a correct blink rate.

    I guess I'm going to have to learn some assembly whether I want to or not.

    Thanks for the lead.

    I'm hoping that I'll have better luck with PicBasic (ie using it as a high level language, rather having to hunt around for register addresses). If I end up doing too much assembly level crap, it will kind of defeat the purpose of using PicBasic. We shall see.....

    Alan

  4. #4
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Smile

    Alan,

    Nice work! - With PBC, you need to find and deal with register addresses like you did. With PBP, you do not (as much). Again, good job.
    Paul Borgmeier
    Salt Lake City, UT
    USA
    __________________

Similar Threads

  1. clock question
    By andrewwaack in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st September 2009, 17:05
  2. Replies: 2
    Last Post: - 1st May 2009, 08:23
  3. Question for all that use MELABS PICBASIC PRO
    By oskuro in forum Off Topic
    Replies: 2
    Last Post: - 24th March 2005, 17:15
  4. Basic Question about PICBASIC
    By zonkwilliams in forum General
    Replies: 1
    Last Post: - 10th March 2005, 21:55
  5. PicBasic Question (PIC16F84)
    By Dan_lay in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th August 2004, 23:45

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