PIC16F88 senior design


Closed Thread
Results 1 to 40 of 72

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by AlaskanEE View Post
    DEFINE OSC 8
    TRISA.1 = 1
    TRISA.2 = 0
    LOOP:
    IF PORTA.1 = 1 THEN HIGH PORTA.2
    GOTO LOOP

    END

    Also if the PIC is outputing a high and I remove the high input I would expect the output to drop as well, but it doesn't. Do I need to include a second IF, THEN statement to achieve this result?
    If you read the code inside your 'LOOP', there's nothing there to tell the pin to go low if the input goes low...therefore...

    DEFINE OSC 8
    TRISA.1 = 1
    TRISA.2 = 0
    LOOP:
    PORTA.2 = PORTA.1
    GOTO LOOP

    Also, check your datasheet regarding PortA and analog settings, section 12.0 of the PIC16F88 datasheet. You might see something there that might throw a wrench into your master plan!

  2. #2
    Join Date
    Apr 2007
    Posts
    21

    Default

    I switched up to using B.1 as an input and B.2 as an output along with the portb.1=portb.2 and it worked well. After about 13 seconds, however, it stops working. Is this due to the fact that I'm relying on the internal oscilator or is there additional code that I don't know about. Also I looked over 12.0 and I see that PORT A pins would need additional lines of code to work, but I'm not fully understanding what their saying. Do the pins for PORTA have to be used for A/D conversion?

  3. #3
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by AlaskanEE View Post
    I switched up to using B.1 as an input and B.2 as an output along with the portb.1=portb.2 and it worked well. After about 13 seconds, however, it stops working. Is this due to the fact that I'm relying on the internal oscilator or is there additional code that I don't know about.
    Common stuff:
    Pullup on MCLR to Vdd?
    .1uf cap across Vdd and Vss?
    Power supply solid and smooth?
    WDT config set to Off?

    Also I looked over 12.0 and I see that PORT A pins would need additional lines of code to work, but I'm not fully understanding what their saying. Do the pins for PORTA have to be used for A/D conversion?
    Keep reading past the first couple of paragraphs, read all about the registers relating to the A/D converter and the ports...You'll figure it out.

  4. #4
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216

    Default

    AlaskanEE -
    Hint....
    Read Section 12.0 as Skimasks suggests, review table 12-1. Now go to pg. 52 and review table 5-2. Look at the column that tells you what the POR, BOR and value after all other resets is. What does it tell you about the default setting of the registers in table 12-1?
    Here's another good tool. Use this LINK to search the forums. It seems to work better than the built in search tool.
    Wisdom is knowing what path to take next... Integrity is taking it.
    Ryan Miller

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Dave
    Always wear safety glasses while programming.

  6. #6
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by mackrackit View Post
    These are in the FACT section.
    True that they are FACTs, but don't you mean FAQ section?

  7. #7
    Join Date
    Apr 2007
    Posts
    21

    Default

    So if I want to use an analog input for port A I need to include a line of code such as this:

    ANSEL = %00001111

    if I want PORTA.0-PORTA.3 to be analog inputs, but if I'm getting serial data in through these pins can I keep them as digital input/output ports and just use the first digital high that comes in from the serial information to activate some output on another pin? Also I found a project that used the code 'ADCON1.7 = 1' to align bit 7 to be right justified and then 'ADCON1.4 = 0' and 'ADCON1.5 = 0' to default to using Vref. When I'm not doing any analog to digital conversion I shouldn't need any of these commands should I?

  8. #8
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924

    Default

    Quote Originally Posted by skimask View Post
    True that they are FACTs, but don't you mean FAQ section?
    Details,Details,Details. FACTs in the FAQ section.

    So if I want to use an analog input for port A I need to include a line of code such as this:

    ANSEL = %00001111
    Check the data sheet for the PIC you are using. I have not used the 16F88 yet, some PICs are a little different.

    if I want PORTA.0-PORTA.3 to be analog inputs, but if I'm getting serial data in through these pins can I keep them as digital input/output ports and just use the first digital high that comes in from the serial information to activate some output on another pin? Also I found a project that used the code 'ADCON1.7 = 1' to align bit 7 to be right justified and then 'ADCON1.4 = 0' and 'ADCON1.5 = 0' to default to using Vref. When I'm not doing any analog to digital conversion I shouldn't need any of these commands should I?
    Something like that.
    Each analog pin can be set to digital or analog.
    If you use serial the pin will have to be set as digital - true.
    If you are not using any analog, set all as digital.

    first digital high that comes in from the serial information to activate some output on another pin?
    NO, serial does not work that way. When a serial signal say XYZ comes in something could be made to happen. If serial ABC comes in something else could happen. If serial QST comes in it could be ignored.

    A digital LOW state is 0 to around 2 volts. Digital HIGH is around 3.6 to 5 volts.

    In between is FUZZY
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. RX TX modules - intermitent communication
    By ruijc in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 11th June 2009, 00:13
  2. pic16f88 & voltage
    By rdxbam in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th February 2009, 09:14
  3. Ghange code from PIC16F877A to PIC16F88
    By savnik in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th March 2008, 16:09
  4. Replies: 8
    Last Post: - 7th December 2006, 15:42
  5. PIC16F88 problem with TOGGLE command?
    By russman613 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th September 2006, 23:31

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