I am doing a project in which I am using Microcontroller Atmel 89C52. The problem I am facing is interfacing between MatLab and Keil. Characters sent by MatLab are directly recognised as characters by Keil, but I am having problems in Integers being sent by MatLab and recognised by Keil. Although both Keil & MatLab use C hence their data types are same Keil data type: signed int bits:16 bytes:2 range:-32768 to +32767 unsigned int bits:16 bytes:2 range:0 to 65535 data types in MatLab uint8 range: 0 to 255 Unsigned 8-bit integer bytes per element: 1 uint16 range: 0 to 65535 Unsigned 16-bit integer bytes per element: 2 uint32 range: 0 to 4294967295 Unsigned 32-bit integer bytes per element: 4 the range of unsigned integers match in both MatLab & Keil then why the problem? 1:_getkey only reads characters 2:unsigned int a; scanf("%u",a); (not working why?) please help.....
Yes That was a mistake in posting... I know the correct block of code is unsigned int a; scanf("%u",&a); but it doesn't work...
Did you initialize the serial interface? We recommend to use a buffer instead (see Keil\C51\Examples\Measure for a sample project that is using an input buffer). Reinhard
"but it doesn't work..." Could you please describe in exactly what way it doesn't work. Also, when posting code snippets, please cut and paste them from your editor to avoid typographical errors which waste everyones time.