Code: Select all
#include <built_in.h>
#include "typedefs.h"
#include "usart.h"
#define BUFFER_SIZE 5
void usart_str_write(char* string)
{
while ((*string) != '\0'){
//while (strlen(string)){
Usart_Write((char) (*string));
++string;
}
Usart_Write('\n'); // add a new line to every string
}
void delay(uint number)
{
while(--number > 0);
}
void main() {
uint temp_res, last_temp_res;
int n;
OSCCON = 0x73; /* internal oscillator at 8 Mhz, system clock = internal oscillator*/
//OSCTUNE = 0X0f; /* oscillator tuning register at max frequency */
CMCON = 7; // turn off comparators
ADCON1 = 0x0d; // Configure Vref and AN0 and AN1
TRISA = 0x3f; // PORTA is input except RA6 and RA7
TRISB = 0x00; // all PORTB pins are output
TRISC = 0x00; // PORTC is output
Usart_Init(9600); // initialize USART on entered baud rate
while(1)
{
usart_str_write("what's up?");
}
}
Received: what's up?
Received: what's up?
rather than what is seen in http://imagebin.ca/view/6Gu8MK.html. I have tried both while loop condition methods using strlen and using the null character, but both have shown the same output on the imagebin link. Is it possible to do what I described I want to display, and how hard is it? Any insights would be very helpful.