Results 1 to 3 of 3

Thread: PIC programming 101

  1. #1
    Administrator N8YX's Avatar
    Join Date
    Feb 2007
    Akron, OH

    PIC programming 101

    Anyone with development experience, please step inside...

    I have a memory unit for an NRD-515. JRC made two different versions - one a 24ch and another a 96 - with the only difference between them being the bank selector (or the lack thereof). An NDH-515 has 1 bank of 24ch whereas the NDH-518 has 4 banks of 24ch. A push button selects the active bank.

    PE1ABR has details of a modification to the NDH-515 which will allow 8 banks of 24ch to be selected. A rotary switch and diode matrix/pull-up resistor array is used to provide a 3-line BCD-coded output which provides for bank-select logic. This requires drilling the unit's front panel then labeling the bank numbers. If I'm going to do this I'd rather fabricate and paint a new front panel. And...since the existing channel readout is digital, I thought "Why not use a PIC, Arduino or BASIC Stamp to expand on the concept and have a digital bank indicator as well?" Doing a little digging, I found a motorcycle gear-counter circuit that uses a 16F628. The assembly code was provided. It has up-down inputs on Port A and uses Port B to drive a single 7 segment display.

    Perfect. Though my assembly skills are rusty as hell. Modifying this is going to be an exercise.

    What's a good, robust IDE for this family of PICs? I looked at MPLABX, and I don't need to buy their Pro compiler as I don't have a need for speed - so the freeware version should work fine. This thing is very simple in concept: Upon power-up and no previously active bank having been selected, default to Bank 0. Pull the three Port A output lines Low, then send a "0" character (defined in an array) out the Port B lines. Loop and look for a switch press (switches connected to two of the other Port A lines for up/down incrementing). Process the switch press accordingly, output the BCD control data on the Port A lines and digit display character data on Port B's lines...then wait for a period and see if no other switch press has occurred. If not in say, 2 minutes then write the Bank Number to a data location in the device's EEPROM. On subsequent loops, compare the existing bank number with the stored bank number; update if changed and keep looping if not.

    Upon subsequent power-ups, look for an existing Bank Number in EEPROM. If present, output the associated control/display data then loop and look for changes as above.

    I'd really like to simulate this before actually programming a physical device...and I'd like to write the code in C if possible. Suggestions, thoughts, ready-made code examples?
    "Everyone wants to be an AM Gangsta until it's time to start doing AM Gangsta shit."

  2. #2
    Whacker Knot WTKX's Avatar
    Join Date
    Aug 2008
    Lakewood, CO
    Most of the time we are punished if we go against the trend. Only at an inflection point are we rewarded. ~ George Soros

  3. #3
    Volcano Tamer N1LAF's Avatar
    Join Date
    Jul 2007
    Ledyard, CT
    Digikey has a wide range of socket-able development kits, some with built-in programmers.

    Microchip Curiosity 8/14/20 pin Eval boards, with built-in programmer $26

    Microchip Curiosity 28/40 pin Eval boards, with built-in programmer $40

    For button press, I use counters. when you have your code in place, you can toggle an output line and measure its frequency when running, tells you the period of your program loop. Knowing that, you can determine the counter value that will give you a positive button press, and compensate for minor switch bounce. You will be able to quickly change banks.
    Last edited by N1LAF; 05-09-2020 at 06:45 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts