Question: ottle Packer Hardware Setup LEDs connected to PORTB Switches connected to PORTA lain Function esign a system that counts the umber of bottles passing on
ottle Packer Hardware Setup LEDs connected to PORTB Switches connected to PORTA lain Function esign a system that counts the umber of bottles passing on a onveyor belt and when 10 have assed so a box is full, the system hunts out the box and shunts in a new Declare Variables unsigned charcount pled using a switch Infrared beam sensor me when the beams Initialise SFRs Set direction of portato inputs broken by a bottle the pin voltage goes high wambroken indicator output is pin 7 of portb beam is broken the microcontroller sets ! Macros Intaise value on PORTB to all low ping to indicate this cok unt control output is pin 6 of portb Wher OK with 10 boes this pin is set high by ocontroller to shunt out the full box and in define SENSOR porta. define SNSR STATUS portb.7 define SHUNT portb.6 define ON 1 detine OFF O Flash LEDS Function to flash LEDs once for 5 seconds to test LEDs and timing Portpins 3 to shows the current number o boles that have passed. Goes back to when new box is shunted in while(1) while Sensor not active SNSR_STATUS ON while Sensor active NO SNSR_STATUS = OFF increment count by 1 SHUNT = OFF port[3.0) - count NO YES count=107 SHUNT ON count=0 ottle Packer Hardware Setup LEDs connected to PORTB Switches connected to PORTA lain Function esign a system that counts the umber of bottles passing on a onveyor belt and when 10 have assed so a box is full, the system hunts out the box and shunts in a new Declare Variables unsigned charcount pled using a switch Infrared beam sensor me when the beams Initialise SFRs Set direction of portato inputs broken by a bottle the pin voltage goes high wambroken indicator output is pin 7 of portb beam is broken the microcontroller sets ! Macros Intaise value on PORTB to all low ping to indicate this cok unt control output is pin 6 of portb Wher OK with 10 boes this pin is set high by ocontroller to shunt out the full box and in define SENSOR porta. define SNSR STATUS portb.7 define SHUNT portb.6 define ON 1 detine OFF O Flash LEDS Function to flash LEDs once for 5 seconds to test LEDs and timing Portpins 3 to shows the current number o boles that have passed. Goes back to when new box is shunted in while(1) while Sensor not active SNSR_STATUS ON while Sensor active NO SNSR_STATUS = OFF increment count by 1 SHUNT = OFF port[3.0) - count NO YES count=107 SHUNT ON count=0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
