Pic16f870


Closed Thread
Results 1 to 14 of 14

Thread: Pic16f870

Hybrid View

  1. #1
    Join Date
    Nov 2007
    Posts
    42

    Default Pic16f870

    I am new to using the PIC Mid-Range MCU's and I am struggling with them.

    I can't seem to get the PIC16F870 to change it's pins to digital. I am only familar with PICBasic Pro.

    Anyhow, from the datasheet and the reference manual for mid-range pic's, it seems that it uses ADCON0 and ADCON1. I have set these bits and my Tris bits. Still doesn't Fing work.

    I have Porta.0, Porta.1, Portb.4, and Portb.5 as digital inputs (for a button press) and all the rest just need to be digital outputs so they can go high or low to switch some NPN transistors on and off.

    Any help on how the hell to get this to function at all would be very appreciated.

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    And what values are you using for the ADCON registers and for the TRIS registers?

    Straight from the PIC16F870 datasheet, DS30569B, Pg 80, and DS30569B, Pg 33, Para. 4.1., Register 10-2.
    Last edited by skimask; - 1st August 2008 at 17:53.

  3. #3
    Join Date
    Nov 2007
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Adcon0=0
    Adcon1=7
    Trisa = %000011
    Trisb = %00110000
    Trisc = %00000000

    This is what I have been using since the beginning and it still doesn't work. I have it on my EasyPIC 5 and when I load a simple code to blink LED's when I "press" one of the 4 inputs buttons, it doesn't blink any of the LEDs..... Very strange, Very confusing, and this chip is going to die via a hammer very soon.
    Last edited by plyrathrt; - 1st August 2008 at 18:06.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by plyrathrt View Post
    Adcon0=0
    Adcon1=7
    Trisa = %000011
    Trisb = %00110000
    Trisc = %00000000

    This is what I have been using since the beginning and it still doesn't work. I have it on my EasyPIC 5 and when I load a simple code to blink LED's when I "press" one of the 4 inputs buttons, it doesn't blink any of the LEDs..... Very strange, Very confusing, and this chip is going to die via a hammer very soon.
    What happens if you load code just to blink LEDs without any button presses at all...just set all of the pins to outputs and blink them all...

  5. #5
    Join Date
    Nov 2007
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    lol.... Not a damn thing. Not 1 pin goes high.

    I have a few of these chips ordered at different times so the likely hood of all of them being bad is not very likely.

    Edited:
    I took out my "DEFINE OSC 8" and no Porta.6 goes high but is not blinking. So I guess it's still "nothing happens"..................
    Last edited by plyrathrt; - 1st August 2008 at 18:35.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by plyrathrt View Post
    lol.... Not a damn thing. Not 1 pin goes high.
    I have a few of these chips ordered at different times so the likely hood of all of them being bad is not very likely.
    Edited:
    I took out my "DEFINE OSC 8" and no Porta.6 goes high but is not blinking. So I guess it's still "nothing happens"..................
    Kinda rules out bad port settings eh?


    What are you using for an oscillator? A crystal? A resonator? External clock input?

    Got a pull up on MCLR?

  7. #7
    Join Date
    Oct 2003
    Location
    holland
    Posts
    251


    Did you find this post helpful? Yes | No

    Default

    ADCON1 = 7

    should be there to set all to digital.
    I'ts all readable in the datasheet of that part.

Similar Threads

  1. i2c non-eeprom examples?
    By justDIY in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 22nd January 2010, 18:07
  2. Peek Poke pic16f870
    By Eric123 in forum mel PIC BASIC
    Replies: 4
    Last Post: - 16th March 2007, 06:07
  3. ASM for dummies
    By Squibcakes in forum General
    Replies: 9
    Last Post: - 28th February 2007, 05:08
  4. help with pic16f870 a/d converter
    By cammo in forum mel PIC BASIC
    Replies: 3
    Last Post: - 22nd March 2005, 05:16

Members who have read this thread : 0

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