Forum: Compiler & IDEs Flasharray an UART ausgeben


von Daniel Goßmann (Gast)


Lesenswert?

Hallo!

Ich versuche ein Array of Char aus dem Flash an einen UART zu senden 
(mega8515). Ich habe mich so weit es ging ans GCC-Tutorial 
http://www.mikrocontroller.net/articles/AVR-GCC-Tutorial#Vereinfachung_f.C3.BCr_Zeichenketten_.28Strings.29_im_Flash 
gehalten (kein String Ende Zeichen), bekomme aber jetzt immer eine 
Compilerwarnung: "pointer targets in passing argument 1 of 
'UART_SendCMD_p' differ in signedness"

Was mache ich falsch?

1
const uint8_t SCS_CMD_RESET[]   PROGMEM = {0xAA, 0xAA, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x3F, 0x01, 0x00, 0x5F, 0x55, 0x55} ;
2
3
void UART_Tx_Byte(char DataByte)
4
{
5
  // Waint for UART ready
6
  while (! (UCSRA & (1<<UDRE))) 
7
    
8
  // Put DataByte to UART Transmit Buffer
9
  UDR = DataByte ;
10
}
11
12
void UART_SendCMD_p(const char *cmd, uint8_t len)
13
{
14
  while (len--) 
15
    {
16
      UART_Tx_Byte(pgm_read_byte(cmd)) ;
17
      cmd++ ;
18
    }
19
}
20
21
void main(void)
22
{
23
  // Aufruf und "pointer targets in passing argument 1 of 'UART_SendCMD_p' differ in signedness"
24
  UART_SendCMD_p(SCS_CMD_RESET, sizeof(SCS_CMD_RESET)) ;
25
}


Gruß
Daniel

von Johannes M. (johnny-m)


Lesenswert?

Ein uint8_t ist nunmal unsigned, während ein char signed ist. Also 
entweder das Argument der Funktion in "const uint8_t *cmd" umbenennen 
oder den Flash-String mit "char" initialisieren anstatt mit "uint8_t"...

von Daniel Goßmann (Gast)


Lesenswert?

Danke Johannes!

Verstehen wäre schöner, als aus dem Tut abtippen, aber nun läuft es.

Gruß
Daniel

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.