#include <33FJ256MC710.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES ICS0
#FUSES NOJTAG
#FUSES NOCOE
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPUT //No Power Up Timer
#FUSES WPOSTS1
#FUSES WPRES128
#FUSES NOWINDIS
#FUSES EC //High speed Osc (> 4mhz)
#FUSES NOOCSIO
#FUSES FRC_PLL
#FUSES NOTEMP
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOWRT //Program memory not write protected
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRTSS
#FUSES NOSSS
#FUSES NORSS
#FUSES NOWRTB //Boot block not write protected
#FUSES NOBSS
#FUSES NORBS
#use delay(clock=40000000)
#use rs232(baud=9600, UART1)
#use standard_io(A)
#use standard_io(B)
#use standard_io(C)
#use standard_io(D)
#use standard_io(E)
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_spi(SPI_SS_DISABLED);
output_high(pin_D0);
delay_ms(500);
output_high(pin_D1);
delay_ms(500);
output_high(pin_D2);
delay_ms(500);
output_high(pin_D3);
delay_ms(500);
output_high(pin_D4);
delay_ms(500);
output_high(pin_D5);
delay_ms(500);
output_high(pin_D6);
delay_ms(500);
output_high(pin_D7);
delay_ms(500);
printf("HOLA MUNDO!!!");
output_d(0);
while(1);
}
#include <33FJ256MC710.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES ICS0
#FUSES NOJTAG
#FUSES NOCOE
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPUT //No Power Up Timer
#FUSES WPOSTS1
#FUSES WPRES128
#FUSES NOWINDIS
#FUSES EC //High speed Osc (> 4mhz)
#FUSES NOOCSIO
#FUSES FRC_PLL
#FUSES NOTEMP
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOWRT //Program memory not write protected
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRTSS
#FUSES NOSSS
#FUSES NORSS
#FUSES NOWRTB //Boot block not write protected
#FUSES NOBSS
#FUSES NORBS
#use delay(clock=40000000)
#use rs232(baud=9600, BITS =8, PARITY=N , STOP=1, uart1)
#use standard_io(A)
#use standard_io(B)
#use standard_io(C)
#use standard_io(D)
#use standard_io(E)
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_spi(SPI_SS_DISABLED);
setup_uart(TRUE);
SET_TRIS_c(0b10000000);
output_high(pin_D0);
delay_ms(500);
output_high(pin_D1);
delay_ms(500);
output_high(pin_D2);
delay_ms(500);
output_high(pin_D3);
delay_ms(500);
output_high(pin_D4);
delay_ms(500);
output_high(pin_D5);
delay_ms(500);
output_high(pin_D6);
delay_ms(500);
output_high(pin_D7);
delay_ms(500);
printf("hola");
output_d(0);
while(1);
}
#FUSES FRC_PLLQue hace este Fuse ??
#include <33FJ256MC710.h>
#device adc=8
#FUSES NOWDT //No Watch Dog Timer
#FUSES ICS0
#FUSES NOJTAG
#FUSES NOCOE
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPUT //No Power Up Timer
#FUSES WPOSTS1
#FUSES WPRES128
#FUSES NOWINDIS
#FUSES EC //High speed Osc (> 4mhz)
#FUSES NOOCSIO
#FUSES PR
#FUSES NOTEMP
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOWRT //Program memory not write protected
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRTSS
#FUSES NOSSS
#FUSES NORSS
#FUSES NOWRTB //Boot block not write protected
#FUSES NOBSS
#FUSES NORBS
#use delay(clock=40000000)
#use rs232(baud=4800, BITS =8, PARITY=N , STOP=1, uart1)
int X=0,Y=0;
char comando='P';
int Barra=0, Valor=0;
void retardo(void){
delay_ms(400);
}
#use standard_io(A)
#use standard_io(B)
#use standard_io(C)
#use standard_io(D)
#use standard_io(E)
void main()
{
set_tris_b(0b00001111);
setup_adc_ports(NO_ANALOGS);
setup_spi(SPI_SS_DISABLED);
setup_uart(TRUE);
output_d(0);
retardo();
output_high(pin_D0);
retardo();
output_high(pin_D1);
retardo();
output_high(pin_D2);
retardo();
output_high(pin_D3);
retardo();
output_high(pin_D4);
retardo();
output_high(pin_D5);
retardo();
output_high(pin_D6);
retardo();
output_high(pin_D7);
retardo();
output_d(0);
while(1){
if(input(pin_b0)==1) output_high(pin_D0);
else output_low(pin_D0);
if(input(pin_b1)==1) output_high(pin_D1);
else output_low(pin_D1);
if(input(pin_b2)==1) output_high(pin_D2);
else output_low(pin_D2);
if(input(pin_b3)==1) output_high(pin_D3);
else output_low(pin_D3);
}
}
El Programa ya funciona, pero, no va con el Baud Rate que se le selecciona. Va al Doble. 4800 realmente seria 9600..Seguro que el micro va al doble de velocidad de lo que tu programa cree. ¿Cuáles son los fuses de configuración del oscilador?
#include "33FJ256GP710.h"
#FUSES XT, NOWDT
#use delay(clock = 8 000 000)
#use rs232(UART2, baud=9600, parity = N, bits = 8)
void main()
{
printf("\r\nEXPLORER 16");
while (true)
{
output_toggle(PIN_A0);
printf("\r\nEXPLORER 16");
delay_ms(1000);
}
}
#include "33FJ256GP710.h"
#FUSES PR_PLL, XT, NOWDT, NOPUT
#WORD CLKDIV = 0x0744 //PLLPOST(6,7) - PLLPRE(0,1,2,3,4)
#BIT PLLPOST_1 = CLKDIV.6
#BIT PLLPOST_2 = CLKDIV.7
#BIT PLLPRE_1 = CLKDIV.0
#BIT PLLPRE_2 = CLKDIV.1
#BIT PLLPRE_3 = CLKDIV.2
#BIT PLLPRE_4 = CLKDIV.3
#BIT PLLPRE_5 = CLKDIV.4
#WORD PLLFBD = 0x0746 //PLLDIV(0,1,2,3,4,5,6,7,8)
#BIT PLLDIV_1 = PLLFBD.0
#BIT PLLDIV_2 = PLLFBD.1
#BIT PLLDIV_3 = PLLFBD.2
#BIT PLLDIV_4 = PLLFBD.3
#BIT PLLDIV_5 = PLLFBD.4
#BIT PLLDIV_6 = PLLFBD.5
#BIT PLLDIV_7 = PLLFBD.6
#BIT PLLDIV_8 = PLLFBD.7
#BIT PLLDIV_9 = PLLFBD.8
#use delay(clock = 80 000 000)
#use rs232(UART2, baud = 115200, parity = N, bits = 8)
void main()
{
// PLLPRE /2
PLLPRE_1 = 0;
PLLPRE_2 = 0;
PLLPRE_3 = 0;
PLLPRE_4 = 0;
PLLPRE_5 = 0;
// PLLDIV *40
PLLDIV_1 = 0;
PLLDIV_2 = 1;
PLLDIV_3 = 1;
PLLDIV_4 = 0;
PLLDIV_5 = 0;
PLLDIV_6 = 1;
PLLDIV_7 = 0;
PLLDIV_8 = 0;
PLLDIV_9 = 0;
// PLLPOST /2
PLLPOST_1 = 0;
PLLPOST_2 = 0;
printf("\r\nEXPLORER 16");
while (true)
{
output_toggle(PIN_A0);
delay_ms(1000);
}
}
El Programa ya funciona, pero, no va con el Baud Rate que se le selecciona. Va al Doble. 4800 realmente seria 9600..Código: [Seleccionar]#use delay(clock=40 000 000)
#use rs232(baud=4800, BITS =8, PARITY=N , STOP=1, uart1)
Pero ahora no me quiere leer los Pulsadores... RARO RARO.