thunaivendan
Member level 3
- Joined
- Apr 19, 2013
- Messages
- 61
- Helped
- 0
- Reputation
- 0
- Reaction score
- 1
- Trophy points
- 1,288
- Location
- Chennai, Tamil Nadu, India
- Activity points
- 1,723
Code:
/* Main.c file generated by New Project wizard
*
* Created: Tue Jun 4 2024
* Processor: PIC16F877A
* Compiler: HI-TECH C for PIC10/12/16
*/
#include <htc.h>
#include <stdio.h>
#include <stdlib.h>
#define QA1 RA0
#define QA2 RA1
#define QA3 RA2
#define QA4 RA3
#define SW RE0
#define SW1 RE1
#define _XTAL_FREQ 20000000
//__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_OFF & BOREN_OFF & LVP_ON & CPD_OFF & WRT_OFF & CP_OFF);
__CONFIG(0x3F72);
//void forwarddirection();
//void reversedirection();
void main()
{
TRISA = 0x00;
TRISE = 0x00;
// TRISE = 0x00;
while(1)
{
if (SW == 1)
{
QA1 = 1;
__delay_ms(1);
QA2 = 0;
__delay_ms(1);
QA1 = 1;
__delay_ms(1);
QA2 = 0;
__delay_ms(1);
}
if (SW1 == 1)
{
QA2 = 1;
__delay_ms(1);
QA1 = 0;
__delay_ms(1);
QA2 = 1;
__delay_ms(1);
QA1 = 0;
__delay_ms(1);
}
}
}
--- Updated ---
Please provide the simulation solution
Last edited by a moderator: