Old analog guy needs help with PIC16F57


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Posts
    22

    Question Old analog guy needs help with PIC16F57

    So I'm venturing away from the PIC16F168A and it's internal oscillator for the first time ever. I need to drive an old BIT display with +5v and -5v. I bought the PIC16F57 because it has enough I/Os to do the job. So I go into the data sheet and after reading it over and over (8 hours worth!), I'm thoroughly confused about the resonator setup. I bought some Murata CSTLS20M0X53-B0 20 MHZ resonators, but now I'm not sure if I can use them. If I can use them, how is the resonator connected to the IC correctly?

    Now for the code ... if I could get an example of a simple code to toggle a port from low to high a few times a second, I can figure out the rest. Any help at all is greatly appreciated!

    ~ Dave

  2. #2
    Join Date
    Jan 2009
    Posts
    22


    Did you find this post helpful? Yes | No

    Angry Still struggling ...

    I tried programming the following code onto two different brand new ICs.

    Code:
    loop:
    
    high portb.4    ' turn the LED on
    pause 500       ' wait 500ms
    low portb.4     ' turn the LED off
    pause 500       ' wait 500ms
    goto loop       ' repeat
    I'm getting a popup that says "Device not blank. Program anyway?" and when I click yes, I get the error "Code programming error at 0000."

    The program is compiled for the PIC16F57 and I made sure that I selected the correct IC in the programmer. I'm bummed.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Looks like a device programmer issue. Usually this error is caused by a too low VPP voltage on MCLR, and/or poor power supply filtering.

    Which programmer are you using? If it's a JDM based + you're using a USB to Serial adapter, then yes, you run into usual problems.

    You can try to erase the device, then reprogram it...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    I think I already have seen something like that on the Forum ...

    So ...

    1) Which is the programmer ???

    2) Is it "up to date" for soft version ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Jan 2009
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    OK, I think I've found the problem. The voltage pins are in odd places on this IC, so I may have to do in-circuit programming; something else that I've never done. I'm going to figure out how to do that next and I'll get back with any results.

    Here's the code that I'll be using for a test:

    Code:
    @ device  pic16F57, hs_osc, wdt_off, protect_off
    
    main:       
    
    high portA.0
    pause 500
    low portA.0
    pause 500
    goto main
    I'm using the old serial programmer and my first problem was not having the cable plugged into the correct header and the IC pin 1 was in the wrong place. Even now with the cable plugged into the correct header and the IC in the ZIF socket correctly, I'm getting a code programming error at 0000.
    Last edited by yankee; - 23rd February 2009 at 16:22. Reason: A better reply.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    The 16F57 is laid out really funky with Vdd on pin #2, Vss on pin #4, Vpp, pgmdata, pgmclock, etc all in odd places, so there's probably not any ZIF adapter compatible with this one.

    Wire it for in-circuit like shown here: http://melabs.com/support/icsp.htm
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Jan 2009
    Posts
    22


    Did you find this post helpful? Yes | No

    Default

    Thanks again Bruce!

  8. #8
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    Quote Originally Posted by Bruce View Post
    The 16F57 is laid out really funky with Vdd on pin #2, Vss on pin #4, Vpp, pgmdata, pgmclock, etc all in odd places, so there's probably not any ZIF adapter compatible with this one.

    Wire it for in-circuit like shown here: http://melabs.com/support/icsp.htm
    Hi Bruce ...

    Microchip AC 162049 Universal adapter CAN do it ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. pic18f analog comparator problem
    By david.silaghi in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 6th May 2009, 09:38
  2. 16F88 Analog In
    By Mugelpower in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 25th March 2008, 08:30
  3. Selection of analog ports
    By enauman in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th December 2006, 03:56
  4. Many Analog Inputs
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 10th July 2006, 08:15
  5. analog inputs on 16F716
    By schwinn_rider in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 6th October 2005, 04:07

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