sobia sarwar
Member level 5
- Joined
- Nov 15, 2012
- Messages
- 81
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,883
i wanted to send some data as text through soft uart to pc because i have already used my tx and rx pins.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
i tried the example of soft uart from mikroc pro library but it dosen't work
char i, error, byte_read; // Auxiliary variables
void main(){
ANSEL = 0; // Configure AN pins as digital I/O
ANSELH = 0;
TRISB = 0x00; // Set PORTB as output (error signalization)
PORTB = 0; // No error
error = Soft_UART_Init(&PORTC, 7, 6, 14400, 0); // Initialize Soft UART at 14400 bps
if (error > 0) {
PORTB = error; // Signalize Init error
while(1) ; // Stop program
}
Delay_ms(100);
for (i = 'z'; i >= 'A'; i--) { // Send bytes from 'z' downto 'A'
Soft_UART_Write(i);
Delay_ms(100);
}
while(1) { // Endless loop
byte_read = Soft_UART_Read(&error); // Read byte, then test error flag
if (error) // If error was detected
PORTB = error; // signal it on PORTB
else
Soft_UART_Write(byte_read); // If error was not detected, return byte read
}
}
what does &PORTC stands for means which port i have to give there.Soft_UART_Init(&PORTC, 7, 6, 14400, 0);
to pc through serial comm and what i read about i have to use soft uart but i m not getting how to use soft uartyour vote casted
char error, byte_read;
int i;
char text[15]="vote casted";
void Soft_UART_Write_Text(char *text) {
unsigned int x = 0;
for(x = 0; x <= strlen(text); x++) {
Soft_UART_Write(text[x]);
}
} // Auxiliary variables
void main(){
//ANSEL = 0; // Configure AN pins as digital I/O
//ANSELH = 0;
TRISB = 0x00; // Set PORTB as output (error signalization)
PORTB = 0; // No error
error = Soft_UART_Init(&PORTC, 17, 16, 9600, 0); // Initialize Soft UART at 14400 bps
if (error > 0) {
PORTB = error; // Signalize Init error
while(1) ; // Stop program
}
Delay_ms(100);
Soft_UART_Write_Text(text);
}
zip file including mikroc pro file and proteus simulation
- - - Updated - - -
i changed the code a little more
Code:char error, byte_read; int i; char text[15]="vote casted"; void Soft_UART_Write_Text(char *text) { unsigned int x = 0; for(x = 0; x <= strlen(text); x++) { Soft_UART_Write(text[x]); } } // Auxiliary variables void main(){ //ANSEL = 0; // Configure AN pins as digital I/O //ANSELH = 0; TRISB = 0x00; // Set PORTB as output (error signalization) PORTB = 0; // No error error = Soft_UART_Init(&PORTC, [COLOR="#FF0000"]17, 16,[/COLOR] 9600, 0); // Initialize Soft UART at 14400 bps if (error > 0) { PORTB = error; // Signalize Init error while(1) ; // Stop program } Delay_ms(100); Soft_UART_Write_Text(text); }
- - - Updated - - -
can you please send me simple code for sending a string through soft uart to pc