Which chip do i use?


Closed Thread
Results 1 to 40 of 78

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    OK

    Some chips have an internal MCLR , I like these for ICSP.

    Let us know how you code works out and where you need help from there.
    Dave
    Always wear safety glasses while programming.

  2. #2
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Im stuck already. You knew it wouldnt be long :P

    Im using a 16MHz oscillator. In my code i have put "define osc 16". The rest of the code simply turns an LED on an off a few times to show the chip is working.

    What im getting is a quick flash when it powers up and when it powers down.

    I think this might be to do with the fuse settings. What should the following be set to?

    WDT
    PWRTE
    BODEN
    LVP
    MCLRE (i assume E means external so Matt had this disabled)
    Oscillator
    Code Protect (i know this should be disabled)

    for Oscillator i have the following options to choose from
    ERCLK
    ERIO
    IRCCLK
    IRCIO
    EXTCLK
    LP
    XT
    HS

    The other options are enabled/disabled.

    BTW. Do you want me to start new threads for any questions about this or stick to this one? Its all the same project

    Edit: Im using a PIC16F627

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


    Did you find this post helpful? Yes | No

    Default

    MCLRE is just the name.
    For internal (Not used for reset but the pins other functions) the fuse should be
    _MCLRE_OFF

    HS for the OSC
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Woo it works Its a bit fast though. i put 100ms pauses in and it flashes a lot faster than when i use a 4MHz resonator. I know 16MHz is 4 times faster but i thought the point of declaring that was so "pause 100" would still take 100ms and not 25. Maby ive got something else wrong. I was reading about timers in the datasheet. I didnt understand any of it but part of it could mean the chip runs 4 times faster than the resonator you use.

    It doesnt matter anyway. If i want 100ms then i just type 400. The point is the LED flashes. Tomoz ill get onto the real code but its 10:00 now so i should be getting to bed. Up at 4:30AM for work

    Anyways. Thanx for that. I would have been lost trying to figure it out myself

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


    Did you find this post helpful? Yes | No

    Default

    Where are you setting the fuses? In the *.inc file or in the code.

    A programmer never sleeps. When things get fuzzy is when some of the best work is done
    Last edited by mackrackit; - 28th November 2007 at 23:11.
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Im setting the fuses in the programmer software right after loading the file. How do you do it in PBP? Its annoying having to keep setting them.

    Also, Serial doesnt appear to be working. This is probs to do with the same problem but how do i figure out what value to give to spbrg? I found this page but im not sure what it all means. I entered 16 and it gives me a table. How do i know what BRGH is set to?

    Edit: Just downloaded a calculator from Mister_e's website. It makes more sense but its still not working. I think ill go sleep on it
    Last edited by The Master; - 28th November 2007 at 23:25.

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Solved the oscillator problem.

    "DEFINE osc 16" doesnt work
    "DEFINE OSC 16" does work

    Serial still not working but i have a feeling thats something simple.

    Ive tried 2 things from Mister-e's calculator
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 25  ' 9600 Baud @ 16MHz, 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    Code:
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $20 ' Enable transmit, BRGH = 0
    SPBRG = 25  ' 9600 Baud @ 16MHz, 0.16%
    I have also added this code
    Code:
    loop:
    if pir1.5=1 then
              newbyte=rcreg
              high portb.0
              pause 100
              low portb.0
    endif
    goto loop
    when any serial data comes in that should make the LED flash but its not doing. I think this might be to do with the circuit itself (currently thinking outside of the box. Using breadboard instead). Ill try and solve that tomoz. For now though i really am going to bed :P Ill let you know how it goes tomoz

Similar Threads

  1. Trouble with PIC16F88 (chip hangs up)
    By nobner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th January 2009, 10:23
  2. Camera with PIC chip
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 1st July 2008, 15:28
  3. More info on L4620 liquid sensor chip
    By Nicmus in forum Documentation
    Replies: 4
    Last Post: - 2nd June 2008, 00:03
  4. TV Display Chip
    By zadok in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 17th April 2008, 23:17
  5. chip selection aid
    By PICMAN in forum General
    Replies: 4
    Last Post: - 21st February 2005, 19:33

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