Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 7 months ago.
Strange character when sending data to VT100 terminal
Hello, I am trying to create 5 boxes, and have a string in each box, below is the code that I have written to carry out this function. However my code has some sort of bug, I can send one string on its own and the box is created perfectly, with no errors, however as soon as I try to send more than one box, I get extended ascii character 200, even if I don't include the box in the code. If anybody can see my error, it would be greatly appreciated.
- include "mbed.h"
- include "Terminal.h"
Terminal S0(USBTX, USBRX);
void serial(char value[],unsigned int y); the ints a,b,c,d,e are used for the location of the extended ascii characters and the location of the text.
unsigned int a = 0; unsigned int b = 4; unsigned int c = 8; unsigned int d = 12; unsigned int e = 16;
value is the string I wish to send to the terminal.
char value[19];
int main()
{ S0.cls();
serial("1:PWM 1 : 50 %",a); serial("2:PWM 2 : 20 %",b); serial("3:PWM 3 : 30 %",c); serial("4:PWM 4 : 60 %",d); serial("5: 5 KHz Frequency",e);
}
void serial(char value[], unsigned int y) { int j; S0.locate(0,y); S0.putc(201);
j=y+1; k=y+2;
S0.locate(1,j); S0.printf("%s",value);
for (int x=1; x<25; x++) { S0.locate(x,y); S0.putc(205);
}
S0.locate(25,y); S0.putc(187);
for( int f = j; f < k; f++ ) { S0.locate(25,f); S0.putc(186); vertical }
S0.locate(25,k); S0.putc(188);
for( int g = 24; g>0; g )
{
S0.locate(g,k);
S0.putc(205);
}
S0.locate(0,k); S0.putc(200);
for( int h = j; h <k; h++ ) { S0.locate(0,h); S0.putc(186); } }