large c programming project code examples for microcontrollers needed

Discussion in 'Programmer's Corner' started by hunterage2000, Jun 23, 2014.

  1. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    hi, can anyone point me in the right direction to find examples of large c microcontroller programs?
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,138
    1,789
    Tell me what you want it for and I might send you one.
     
  3. djsfantasi

    AAC Fanatic!

    Apr 11, 2010
    2,802
    832
    What uP? What is "large"?
     
  4. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    Sorry I should of said "complex". I need to see something that constantly monitors a series of failsafe's i.e emergency stop switches while controlling the speed or torque of a DC motor through a varied PWM voltage or current.

    I was thinking if this just used a load of if statements that just constantly scanned the inputs to the failsafe switches and the control in an infinite while loop.
     
  5. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    That's a simple project. :)

    If you have multiple safety switches, connect them to the same 8bit port. So all port pins are 1 when safe, but any switch activated will make that pin a 0.

    Then check the port in one operation;
    if(PORTB != 0xFF) // if a switch is tripped!

    which is very simple and quick. Obviously if a switch is tripped, you can then do some tests and see which one it was. But the main code only needs that one line to check all switches are safe.
     
    Chalma likes this.
Loading...