- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello I communicate through a translator because I am from Ukraine. so I'll try to write my mistake more affordable.
I'm posting from Uart characters write them in time. characters must be converted to an integer and perform mathematical operations on them. for example, I sent values of 15.35 and I want to add to the first and the second number to 10.
15 + 10 = 25
35 + 10 = 45
bring them to the screen
I do accept values
#define BUF_SIZE 128
char buf[BUF_SIZE];
unsigned int buf_cnt = 0;
****************
int main( void )
{
uart_init();uart_init();
uart_puts( "Hello Andriy\r\n" );
while(1)
{
char c= uart_getc();
if( (c == '\n') || ( c == '\r' ) )
{
buf[buf_cnt] = 0;
buf_cnt = 0;
uart_puts(buf);
}
else
{
if( buf_cnt < BUF_SIZE )
{
buf[buf_cnt] = c;
buf_cnt++;
}
}
}
}
- Labels:
-
PSoC 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I tried to use atoi() and it's did't work, can you write me code, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I cannot, I do not have a PSoC1 at hand to test check internet for yourself.
What error have you got?
Bob