Osctune


Closed Thread
Results 1 to 36 of 36

Thread: Osctune

Hybrid View

  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    As long as I've been working with PICs and PBP, I am still intimidated when I see an ASSY program, and I am going to read this ApNote fully today. Do you incorporate this routine into your PBP program to run at some predefined interval? Another thing that concerns me is that it appears to use Timer1, and I want to use DT_INTs, including the elapsed timer routine. Will this clobber that? Can you tell me or show me how you incorporate this into a PBP program? (I am doing what Charles is, and need an accurate INTRC for a high speed uart.)

    Thanks for any further enlightenment for getting this routine flying.

    (I hope to use this with an 18F2420).
    Last edited by circuitpro; - 29th September 2010 at 17:47.

  2. #2
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    If you are building a PIC network, and need some pointers, I can give you some if you wish.

    Unless you get really creative, you have to turn off interrupts while you send/receive in software.
    Charles Linquist

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    I got a little rushed on this project, and didn't really consider some of the issues. I needed the space and ASSumed that the internal oscillator would be good enough. I dedicated the only hardware uart to a 9600 baud input because I need to use a DT-interrupt to receive the input character-by-character. Now I'm stuck trying to use DEBUG for a port that really needs to be faster than 9600. (Hence my earlier post inquiring as to how fast I could count on DEBUG to work). I should have either used a PIC with 2 uarts or gone ahead and plunked an oscillator down on the board. I MAY be able to use the prototypes using the internal oscillator, we'll know in a few days.

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Don't be discouraged. I'm using an 18F8723 connected to any number of 18F2221s. The 2221's are remote sensors (temperature, humidity) and are very small. They couldn't generate any heat otherwise they would screw up the readings, so I run them on their internal oscillators at 4MHz to keep the power low. The sensors use the internal EUSART for receive, but have to shut the EUSART off to transmit, since I needed an open-collector transmitter, and the hardware (without an outboard FET, at least) is incapable of running open-collector. In order to meet my timing criteria, I needed to run 19.2Kbaud (for system timing reasons). Serout2 can't run 19.2 at 4Mhz, but DEBUGOUT does. The problem is - DEBUGOUT doesn't have an open-collector option, so I modified PBPPIC18.LIB to give me a debugout open-collector option. That works.

    The sensors have a HSERIN interrupt running. When a character comes in, and there is an address match, the DEBUGOUT is invoked (it is also inside the ISR) and the response is sent. When not in the ISR, the PIC is continuously polling its temperature and humidity sensors.

    The whole thing works very well, and has been tried with over 150' of cabling and 8 sensors.
    Charles Linquist

  5. #5
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Update:

    I found a spool with 500' of Belden 8444 (unshielded, not twisted, 22Ga 4 conductor). I put a sensor at one end and hooked it to my PIC test board. It didn't work.

    I lowered the Baud rate to 9600. It still didn't work. I lowered the pull-ups from 2.2K to 820 ohms. It worked perfectly! A scope showed the signals looked more than acceptable. This is driving directly from PIC pins.
    Charles Linquist

  6. #6
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Wow. Thats open-collector TTL, right? If you really needed more distance, you might try RS485. You can turn each driver off at the sensor when not transmitting, it's a great long-distance party line, and it likes 100-120 ohm hose.
    Last edited by circuitpro; - 1st October 2010 at 05:02.

  7. #7
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    The sensor is capable of RS-485, both half and full-duplex, and I have used that before. The sensor board (0.25" wide X 1.9" long) has stuffing options that allow all sorts of protocols - I2C,RS232,RS-485.

    I have 8 or 10 different "Main" (or controller boards) already designed, any one of which that could control the sensor array. The particular feature set the customer wants, (SSH, SNMP, telnet, Real-Time Clock, Large event log) is on a board that doesn' t have an RS-485 chip. I don't want to design a new add on board at this time, so I'm going with the single-ended stuff. The customer will be using 30 sensors on 400' (total) of 4-wire cable. I think it will work!
    Charles Linquist

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