jrgob
Joined: 21 Jan 2010 Posts: 10 Location: Brazil
|
transfer code 16f877 to 12f675 |
Posted: Thu Jan 21, 2010 5:18 am |
|
|
Hello!
First sorry for my English, but I have a doubt about a code that use the PIC 16F877A and need to transfer a 12F675. The code is very simple, but the problem I think is in any configuration of 12F675. Below is the code that works in the 16F877A and the code that I moved into the 12F675. Code: |
#include <16f877.h>
#use delay (clock=10000000)
#include <cuscostdio.h>
#fuses HS, NOWDT, PROTECT
void main(void){
int16 count = 0;
int16 x = 0;
output_a(0x00);
output_b(0x00);
output_c(0x00);
output_d(0x00);
while(1){
count = read_eeprom(20);
while(count<4){
delay_ms(1000);
output_high(pin_c3);
delay_ms(1000);
delay_ms(1000);
output_low(pin_c3);
count++;
write_eeprom(20,count);
}
x = read_eeprom(20);
if(x>=4){
output_high(pin_e2);
if (pulso(D1)){ // function pulse()
write_eeprom(20,0);
}
}
delay_ms(10);
}
}
|
Code: |
#include <12F675.h>
#rom 0x2007={0x14C}
#use delay(clock=4000000,restart_wdt)
#define D1 ra4
#define led_red ra1
#define buzzer ra2
#rom 0x2114={0B00000001}
#rom 0x2115={0B00000100}
#rom 0x2116={0B00000001}
int16 count = 0;
int16 x = 0;
void main(void){
config_ini();
while(1){
restart_wdt();
count = read_eeprom(20);
while(count<4){
delay_msv(1000);
output_high(led_red);
delay_msv(1000);
delay_msv(1000);
output_low(led_red);
count++;
write_eeprom(20,count);
}
x = read_eeprom(20);
if(x>=4){
output_high(buzzer);
if (D1==1){ //key D1
write_eeprom(20,0);
}
}
delay_ms(10);
}
}
|
PS: The function "pulse()" is a library named "cuscostdio" created by a professor based on the standard library of CCS.
If anyone has a toggle function and can send me, because the "pulse" (pulse) is equal. _________________ Thanks.
jrgob |
|