Going nuts here with a PIC16F688. What registers am I missing?


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    20

    Default Going nuts here with a PIC16F688. What registers am I missing?

    All I want to do is set every IO pin on the chip to digital out.

    Code:
    ADCON0 = 0      ' no analog >< digital conversions
    ADCON1 = 0      ' no analog >< digital conversions
    ANSEL = 0       ' no analog inputs
    CMCON0 = 7      ' no comparators
    TRISA = %0000100' all but RA3 (MCLR) is output
    TRISC = 0       ' all outputs on port C 
    
    porta = 1
    portc = 1
    pause 1000
    porta = 0
    portc = 0
    This should blink all of the attached LEDs, however only PORTA.0 and PORTC.0 go high and only one of them goes low when told to. I'm sure I'm forgetting to turn off a feature in a register (or something equally as simple). But I've been studying the datasheet for hours. Any hints? :-\

  2. #2
    Join Date
    Mar 2006
    Location
    China
    Posts
    266


    Did you find this post helpful? Yes | No

    Default well

    That is just what you told the PIC to do.

    porta = 1 ' 0000 0001
    portc = 1 ' 0000 0001
    pause 1000
    porta = 0
    portc = 0


    porta = 255 ' 1111 1111
    portc = 255 ' 1111 1111
    pause 1000
    porta = 0
    portc = 0


    First code sets bit 0 only, second code sets all bits for the port

  3. #3
    Join Date
    Jun 2007
    Posts
    20


    Did you find this post helpful? Yes | No

    Default

    That's what I get for attempting binary math after my bedtime. lol. Thanks for the help!

Similar Threads

  1. LCD's with Shift Registers, and LCDOUT
    By Darrel Taylor in forum PBP Extensions
    Replies: 11
    Last Post: - 3rd April 2015, 14:34
  2. PIC18F4550 Error[128] Missing Arguments
    By damalu in forum mel PIC BASIC
    Replies: 9
    Last Post: - 17th November 2008, 21:47
  3. MCP23016 missing D7 on I2CRead
    By TWSK in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th June 2007, 18:37
  4. Use the PIC 16f877 or 877A instead of shift registers.
    By tsanders in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th October 2006, 17:23
  5. Set the UCFG register or registers in general
    By eDub in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 23rd July 2006, 19:46

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