PIC10F322 Applications – Cascaded Timer
The code (cascaded_timer.c) and headers can be found in my GitHub here – https://github.com/JamieStarling/MCU_FUN/tree/master/Microchip/PIC10F322/
If you haven’t noticed I have been going though a copy of The Engineer’s Mini-Notebook – 555 Timer IC Circuits (Radio Shack) for some of these projects.
The Cascaded Timer – when input on PORTA.2 goes low – PORTA.0 will go high, for 1 second, then LOW, Then PORTA.1 will go high, for one second, then LOW. The on time can be changed by adjusting the On_Value.
/*
* File: cascaded_timer.c
* Author: Jamie
*
* Created on August 16, 2020, 8:56 PM
*/
#include "includes/10F322_deviceconfig.h"
#include "includes/gpio.h"
#include "includes/wpua.h"
#define ON_Value 1000 //On Time in MS
void main(void) {
pinMode(0,OUTPUT);
pinMode(1,OUTPUT);
pinMode(2,INPUT);
enableWPUA(2);
digitalWrite(0,OFF);
digitalWrite(1,OFF);
while(1)
{
if (!digitalRead(2))
{
digitalWrite(0,ON);
__delay_ms(ON_Value);
digitalWrite(0,OFF);
digitalWrite(1,ON);
__delay_ms(ON_Value);
digitalWrite(1,OFF);
}
}
}