nagkiller
Full Member level 4
- Joined
- Jul 9, 2009
- Messages
- 238
- Helped
- 37
- Reputation
- 74
- Reaction score
- 37
- Trophy points
- 1,308
- Location
- Brazil
- Activity points
- 2,706
CCS Count Input time in Low and High State of PIN
How to count time up and time down, write value to eeprom and show in terminal using CCS Compiler???
This is the code in U1... TX
I wanna to count 30 times in low and high in U2 (RX).
Any help please???
How to count time up and time down, write value to eeprom and show in terminal using CCS Compiler???
This is the code in U1... TX
Code:
#include <12F629.h>
#FUSES NOWDT
#FUSES INTRC_IO
#FUSES NOMCLR
#FUSES NOBROWNOUT
#use delay(int=4000000)
void main()
{
while(TRUE)
{
output_a(0xFF);
delay_ms(10);
output_a(0x00);
delay_ms(25);
}
}
I wanna to count 30 times in low and high in U2 (RX).
Code:
#include <12F629.h>
#FUSES NOWDT
#FUSES INTRC_IO
#FUSES NOMCLR
#FUSES NOBROWNOUT
#use delay(int=4000000)
#use rs232(baud=1200,parity=N,xmit=PIN_A1,rcv=PIN_A2,bits=8)
int tempo =0;
int conta =0;
int endereco =1;
void main()
{
while(TRUE)
{
do
{
printf("\r\n\****************");
printf("\r\n\ ");
printf("\r\n\Conta = %u" conta);
do
{
tempo++;
} while (!input(PIN_A4));
printf("\r\nTempo Low = %u" tempo);
write_eeprom( endereco, tempo );
tempo=0;
endereco++;
do
{
tempo++;
} while (input(PIN_A4));
printf("\r\nTempo High = %u" tempo);
write_eeprom( endereco, tempo );
tempo=0;
endereco++;
conta++;
printf("\r\n\ ");
} while (conta <= 29);
printf("\r\n\****************");
printf("\r\n\ ");
printf("\r\nEND COUNT!!!");
printf("\r\n\ ");
printf("\r\n\****************");
break;
}
}
Any help please???
Last edited: