Square wave Monitoring

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Square wave Monitoring

520 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kalevikrant on Thu May 22 10:00:50 MST 2014
           
              I have designed small project for monitoring Square wave input from 2 External device. I have connected 1st device as input to one port. Similarly square coming from second device goes to another port. Need to write program for monitoring input from both the source, and give alarm on any port ,if any one signal gets discontinued. Can any one help me in developing coding to accomplish this task
Labels (1)
0 Kudos
4 Replies

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxp_apps on Fri May 23 14:58:55 MST 2014
Hi,

Other suggestion would be to use the pattern match feature on the LPC800 which can realize boolean logic.

Thanks.

nxp support
0 Kudos

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri May 23 12:37:00 MST 2014
Hi Kalevikrant,
As suggested by starblue you can use SCTimer block to measure and monitor input signal frequency as well as On/Off time of the waveform . Please have look  at SCtimer/PWM cookbook example SCT_pwm_decode and SCT_rc5_receive. Cookbook is available at

http://www.lpcware.com/content/nxpfile/lpc80-sct-cookbook-and-tutorial-code-examples
0 Kudos

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by starblue on Fri May 23 01:02:33 MST 2014
Using GPIO interrupts may be overkill if the input square waves are slow (say a couple of hundred Hz or slower).

In that case it would be easier and more robust to use some state machine in a regular timer interrupt or task.
0 Kudos

508 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Fri May 23 00:34:23 MST 2014
Configure these 2 Ports to generate interrupts on rising or falling edge.
In your interrupt function, use 2 timers, one for each port. If a port has a rising edge, (re)start the corresponding timer.
In normal operation, the timer does not overflow, because it is restarted by the next rising edge.
Configure the timers to rise an interrupt on overflow.
If your overflow interrupt function is called, trigger the alarm.

regards
Wolfgang
0 Kudos