nagufever WROTE:You mean your example is a full code or syntax?
NO
nagufever WROTE:You mean your example is a full code or syntax?
ober WROTE:What do you mean by full code and syntax?
nagufever WROTE:i am using his example to do the program but it returns error.can u explain his example?
nagufever WROTE:Attached the code,schematic and error message for the code.Can you correct the mistakes or point how to correct it?i want to send data using switch to the transmitter.
#include <pic.h>
#include <htc.h>
__CONFIG(0x3F32);
#define PB1 RA0
#define PB2 RA1
#define PB3 RA2
#define PB4 RA3
#define BAUD 1230 //~1200
#define _XTAL_FREQ 20000000
void pic_init(void);
void uart_init(void);
char read_button(void);
void uart_transmit(char data);
main()
{
unsigned char data;
pic_init(); //initialize PIC
uart_init(); //initialize UART
for(;;){
data=read_button();
uart_transmit(0xFF);
uart_transmit(data);
}
}
void pic_init(void)
{
TRISA=0b001111;
TRISB=0b00000000;
TRISC=0b10000000;
TRISD=0b00000000;
TRISE=0b000;
ADCON1=0b00000110;
PORTA=0b00000000;
PORTB=0b00000000;
PORTC=0b00000000;
PORTD=0b00000000;
PORTE=0b00000000;
}
void uart_init(void)
{
TXSTA=0b10100000;
RCSTA=0b10010000;
SPBRG=(int)(_XTAL_FREQ/(64.0*BAUD)-1);
}
char read_button(void)
{char i=0;
if(PB1==0) i=i+1;
if(PB2==0) i=i+2;
if(PB3==0) i=i+4;
if(PB4==0) i=i+8;
return i;
}
void uart_transmit(char data){
while(TXIF==0) continue;
TXREG=data;
}
nagufever WROTE:Does L293D motor driver enough to carry load for 12V car power window DC motor?how much does the current need for the 12 power window to rotate or i need to use different motor driver?
Users browsing this forum: No registered users and 4 guests