how large and complex firmware you design using pbp?


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post
    I have a program that completely fills a 128K part (18F8723). It has about 8000 lines of source, and the .HEX file that I use to program the part is 342K bytes.
    Just out of curiosity, what does your application do that takes up 128K?

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


    Did you find this post helpful? Yes | No

    Default

    Monitors 9 fan tachometers, 5 analog voltages, 4 temperatures, 4 currents and up to 32 humidity sensors, displays all data on LCD and LEDs, drives about 10 parallel I/O and runs relays and controls fan speeds on the basis of temperature using the PWM controller, talks over RS-232 and Ethernet using UDP, tcp, SNMP and SSH protocols. The heavy network stuff is handled by a Lantronix XPORT or MatchPortAR, although all the SNMP and trap handling is done by the PIC.

    Virtually everything is programmable through menus. All the display, entry and bounds checking routines take up quite a bit of codespace.
    Charles Linquist

  3. #3
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Thank you, Charles.

  4. #4
    Join Date
    Dec 2008
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Incredible Charles! congratulations for its work! Very nice!

    How you structuralized the source code? You use state machine with interrupt for receive data from RS232? And the "parser" for decode each string from serial? You can post more details?

    Thanks, christian

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


    Did you find this post helpful? Yes | No

    Default

    I can give you a few details.
    The tachometers are read with an ASM interrupt on a 500uSec timer. Input ports are read and XORed against their last readings. If any bit has changed, a corresponding variable is incremented.
    After 1 second (2000 interrupts), the variables are stored and the process repeats.

    A main PBP loop reads the stored variables and calculates the fan RPMs. It also reads the A/Ds, calculates the required PWM values and writes that value directly to the hardware PWM registers, and writes to the LCD and LEDs. Another counter in the main timer interrupt routine paces everything.

    Two PBP interrupts read the two USARTS and process input serial data and SNMP packets.

    It does quite a few other things as well, but I have a conference call starting in a few minutes!
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    A few more details - the main PIC communicates with a network of current, humidity and pressure sensors. Each of the remote sensors is built with an 18F2321. Every two seconds the main PIC sends three bytes - the address, a command, and a checksum to all the slaves using DEBUGOUT (since all the USARTS are already used). The appropriate slave sends back 4 bytes - the address of the slave, two bytes of data, and a checksum. Open-collector mode is used so that the outputs of the sensors can all be tied together on one wire (an 820 ohm pull-up is used). The slaves all respond to address 254 by default on programming. Whatever number is sent in the command byte to a slave at address 254 becomes the slave's new address and is stored in the '2321's EEPROM. This way a slave's address can be set without using jumpers. The slaves all run on their internal 8Mhz oscillators, and amazingly, communicate reliably at 19.2K baud with the master (which is running at 40Mhz).
    I did have to modify PBPPIC18.LIB to allow DEBUGOUT (on the slaves) to run open-collector.

    The slaves basically read their associated sensor(s) and then sit in a tight loop waiting for the main PIC to send their address and command. As soon as they recognize their address, command and checksum, they wait 10uSec and send the data back.


    This is probably more than anyone wanted to read, but you asked...
    Charles Linquist

  7. #7
    Join Date
    Sep 2003
    Location
    Vermont
    Posts
    373


    Did you find this post helpful? Yes | No

    Default

    I started on PBP, and have designed hundreds of programs for commercial products. I was tempted to play with Swordfish for 32 bit variables, but since Melabs released 2.50, I have had no need. The most timing critical app was a video on screen display using a 16F628 and gated oscillator. This I did in assembly.
    Being an RF junkie, I recently started programming the TI 1110 and 2510 RF transceivers. These are 8051 derivative cores, so C was the only way to go. It was a real challenge going from PBPs "anything goes" forgiving language to a fanatically rigid structure of program writing, but it helped my coding style.
    I still haven't hit my head with PBPs capabilities, but I'll keep trying!
    Ron

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Charles Linquis View Post

    This is probably more than anyone wanted to read, but you asked...
    Nope, sometimes the thought process behind the code is more valuable than a code example. Very interesting, Thanks Charles !
    JS
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. Making a menu
    By chrisshortys in forum mel PIC BASIC Pro
    Replies: 36
    Last Post: - 12th November 2008, 20:54

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