estou com um problema de principiante, ma p mim é um problemao. fiz um programinha bemsimples e funciona maravilhoso, só que para o 12f683. hoje tentei botar um 675 porque nao achei 683 , mas nao funciona nem com reza.
ja no MPLAB, onde habilita ou desabilita o mcrl ele finciona pois vejo no osciloscopio, mas quando alimento peo circuito 5V, nao funcionan nada. Ja tentei botar um 10k no pino 4 MCLR , ja tirei e coloquei MCLR, NOMCLR.. e nada. Ai novamente. Se eu programo ele no MPLAB e vou la no icom para rodar o PIC, etao tudo blz.. ai vai o programa que funciona no 683.
INICIO
cpp code
#include <12f675.h>
#device adc=10
#use delay(clock=4000000)
#fuses nowdt,intrc_io,put,noprotect,brownout,nomclr
#use fast_io(a)
#define fonte PIN_A1 // define pin for LED
#define flash PIN_A4
int16 luz = 0;
int tempo =0;
int flash2 =1;
void init(void) // hardware initialization
{
output_low(fonte); // LED off on boot
output_low (flash);
set_tris_a(0x01); // gpio.0 input, rest outputs
// setup_oscillator(OSC_4MHZ); // set for 4MHz internal osc
setup_adc_ports(AN0_ANALOG); // a/d enabled on gpio.0
setup_adc(ADC_CLOCK_DIV_4); // a/d clock
setup_comparator(NC_NC_NC_NC); // disable comparator module
}
Void beacon ()
{
delay_ms(1300);
output_bit(FLASH,flash2);
delay_ms(185);
output_bit(FLAsh,0);
}
void main()
{
init(); // configure hardware
while(true) // continuous loop
{
set_adc_channel(0);// set a/d channel to gpio.0
delay_ms(100); // delay for acquisition
luz = read_adc(); // read a/d into ad variable
if(luz>470);
{
beacon();
}
if(luz>500)
{
output_high(fonte);
}
if(luz<470)
{
tempo++;
delay_ms(300);
if((luz<470) && (tempo >=2));
{
output_low(fonte);
tempo=0;
}
}
}
}
obrigadao...
Eloy.