Using a new PIC part no. for the first time is always such an adventure.


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20

    Default Using a new PIC part no. for the first time is always such an adventure.

    I need to provide 32 logic outputs based on a serial transmission from a PC so I chose a PIC16F747. Serial output (status) from the PIC is also read by the PC. The 16F747 it would seem was a good choice. Up until now, I have been successfully using a PIC16F628A to do the same thing just with too few outputs for this project.

    I am confident that the circuit board is correct. The PIC has duplicate Vdd and Vss which I have tied together and placed a .1u axial ceramic cap across. It is setup for ICSP and I have verified the existence of code and configuration in flash memory.

    I cannot as yet get the PIC to blink an led on one or two of the pins. This is my initial way of checking for intelligent life in these little buggers. Since I am using the internal RC clock and I have no circuit traces on the board to support an external oscillator it is pretty difficult to see if there is a clock signal.

    As an alternative test, I changed the configuration word to provide internal Osc with Focs/4 out on pin OSC2. When I use my logic probe (in pulse mode) to check OSC2 the pulse indicator appears to remain lit rather than pulsing which I don't understand unless the signal there is so fast that the probe indicator is flashing too fast for me to detect. (Yes I could use my old beater scope but it is borderline unreliable and a bear to set up.)

    I have searched around in the documentation and have not found the default speed at which the internal RC oscillator runs. If it is remarkably fast, then what I am seeing at OSC2 in the test might make sense. In any case I need to know what this default is. Does anybody know what the default internal RC osc. speed is?

    Secondly, as I have found with the 16F628A that the comparator module has to be specifically set OFF or PortA pins will misbehave. Are there any other modules which start by default which prevent any of the I/O pins from functioning as strictly I/O?

    Attached are 3 photos of the board, the configuration as read from the PIC after programming, and the PicBasic code listing.
    Attached Images Attached Images     
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default

    Default value is set to 32.xxx KHz, see
    http://ww1.microchip.com/downloads/e...Doc/30498c.pdf

    pdf page 40, OSCCON register

    That's pretty slow. Just change OSCCON value and you can run it up to 8MHz

    Next step, ADCON1 register, PDF page 155.

    HTH
    Steve

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

  3. #3
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Got it going but..

    I spent 6 hours studying the docs. It didn't take long to get the oscillator right but disabling all the special purpose pins is a real bear.

    Anyway, I got the USART working, partly anyway, I can get the PIC to output text to the PC via my serial cable and RS232-9 pin connected to TX pin, but sending characters back to the PIC into the RC pin, is really not working. I have set BRGH high (1) and SPBRG for 9600 (25) for the 4Mhz Fosc. Enabled receive and set all the other bits I can determine to be necessary. Still no go.

    Maybe the internal RC clock is not precise enough. I am going to retrofit an external oscillator ext and see if that works, otherwise I've hiot another wall.

    Anyone out there used this animal in USART implementation?

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


    Did you find this post helpful? Yes | No

    Default

    I know it's a long debate and some have success, some not, but i never suggest to use internal osc for reliable serial comm. BUT you can reduce the baudrate, say 2400 baud, and do some tests.

    Use PICMultiCalc to get the USART settings for you.
    http://www.mister-e.org/pages/utilitiespag.html

    Yours seems to be the good one... just post your code here and maybe we could suggest you few things.
    Steve

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

  5. #5
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Calculator and stuff

    Pretty cool calculator. Looks like you have a pretty good handle on DataComm.

    I'm going to retrofit the external osc. tonight and see what happens. I only have two osc. right now that run at 4Mhz. That has always been fast enough on my 16F628A's to get 9600. In my real time application though, 2400 might be enough.

    I refined the code last night and will work on it again tonight, so I could attach it as a .txt file tomorrow.

  6. #6
    Join Date
    Mar 2005
    Location
    Madison, WI, USA
    Posts
    20


    Did you find this post helpful? Yes | No

    Default External Osc works great

    I found and 8Mhz osc. laying around and put it into the circuit. With the specs. from the baud calculator inserted into the code the code ran first time out giving me accurate I/O from the PC. Now I'm just one pin short of getting 32 outputs. I'll probably be forced to use the input only MCLR as a DebugIn and another one for DebugOut instead of the hardware serial. That would free up C6 & C7 for outputs.

    Thanks for the pointers.

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


    Did you find this post helpful? Yes | No

    Default

    well, there's always pros and con for using external OSC, if you have many push buttons, you may use the ADC and read from it. a r2r network and ADC can work with at very least 16 push buttons. many many stuff can be multiplexed as well.

    You could also waste your time and try to tweak the internal osc using OSCTUNE... as i said... a REAL waste of time knowing the cons of internal RC osc for reliable timing needs.
    Last edited by mister_e; - 20th December 2007 at 22:58.
    Steve

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

Similar Threads

  1. Presetting Configuration Fuses (PIC Defines) into your Program
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 82
    Last Post: - 15th December 2013, 10:54
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 15:46
  3. newbe looking for PIC advice
    By Mad Professor in forum General
    Replies: 3
    Last Post: - 27th May 2009, 08:56
  4. Can a PIC PIC a PIC?
    By afbecker in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd January 2008, 20:55
  5. Linx RF -> HSERIN time delay / time critical app...
    By batee in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 15th October 2004, 16:04

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