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
    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.

  2. #2
    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

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

    Default

    Dave
    Always wear safety glasses while programming.

  4. #4
    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?

  5. #5
    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?

  6. #6
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by AlaskanEE View Post
    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?
    Basically, the deal is, you have to look at the register's default values (the little numbers above the blocks in the register descriptions in the datasheets). If it says 'R/W-0', then it's a read/write register and on RESET(MCLR), it's set to '0'...and so on...

    So basically, you're on the right track with what you said. I don't have the datasheet handy, you could be right on the bits, if that's what you read, then that's what it is.

  7. #7
    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.

  8. #8
    Join Date
    Apr 2007
    Posts
    21

    Default

    What if I told my partner to have his program send an ASCII character, say, "A" before any message is sent to our bluesmirf which is connected to our LCD through my PIC. Could I use that character to activate a series of commands that would send the correct hexadecimal code to the LCD to activate the backlight then wait 10 seconds then send the code to turn off the backlight? Something like this:

    INCLUDE "modedefs.bas"

    SEROUT PORTB.1,T9600,[1]

    SERIN PORTA.1,T9600,["A"]

    IF PORTA.1 = "A" THEN
    PORTB.1 = $FE
    PORTB.1 = $96
    PAUSE 10000
    PORTB.1 = $FE
    PORTB.1 = $80
    endif

    I'm almost sure that's not right since I'm not sending out serial data just hexadecimal numbers, but can I use the serin/serout commands inside the IF/Then statement? or am I closer than I think.

  9. #9
    skimask's Avatar
    skimask Guest

    Default

    INCLUDE "modedefs.bas"

    SEROUT PORTB.1,T9600,[1]

    SERIN PORTA.1,T9600,["A"] ---- this would only wait for the "A" character, it wouldn't save it anywhere or do anything with it...

    IF PORTA.1 = "A" THEN ---- again, you haven't saved your "A" character anywhere
    PORTB.1 = $FE ---- it's a bit output that you're trying to send a byte out of, that don't work, but I think you already know that...


    What you probably want is:

    INCLUDE "modedefs.bas"
    inputdata var byte
    main:
    SEROUT PORTB.1,T9600,[1] 'trigger something somewhere else
    waitloop:
    SERIN PORTA.1,T9600,[inputdata]
    if inputdata <> "A" then goto waitloop
    serout portb.1,T9600,$FE, $96: pause 10000:serout portb.1,T9600,$FE,$80:goto main
    goto main

Similar Threads

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