04/06/14 15:48
pocho183
presumo che indichi questa riga come unsigned:
char array_string[kLunghezza][12];
Però il codice lo sto adattando su un dei microprocessori della Texas instruments
ti posto il codice magari capisci anche questo:
questo èl'errore:
../main.c", line 47: error #515: a value of type "char *" cannot be assigned to an entity of type "unsigned char"
e questa è la riga
UCA0TXBUF = valori_string[k];
char array_string[kLunghezza][12];
Però il codice lo sto adattando su un dei microprocessori della Texas instruments
ti posto il codice magari capisci anche questo:
#include <msp430.h> #include <stdlib.h> #include <stdio.h> #define lunghezza 3; int valori_interi[3]={120,43,253}; char valori_string[3][12]; void TXByte(int *array_interi, int len); void main (void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT if (CALBC1_1MHZ==0xFF) // If calibration constant erased { while (1); // do not load, trap CPU!! } DCOCTL = 0; // Select lowest DCOx and MODx settings BCSCTL1 = CALBC1_1MHZ; // Set DCO DCOCTL = CALDCO_1MHZ; UCA0CTL1 |= UCSWRST; // **Initialize USCI state machine** UCA0CTL1 |= UCSSEL_2; // SMCLK UCA0BR0 = 104; // 1MHz/9600= 104.1666 UCA0BR1 = 0; // 1MHz 9600 UCA0MCTL = UCBRS0; // Modulation --------------------------------------------- P3SEL = BIT4 | BIT5; // P3.4,5 = USCI_A0 TXD/RXD UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine** while (1){ TXByte(valori_interi,3); } } void TXByte(int *array_interi, int len) { int k=0; int i; for(i=0;i<3;i++){ sprintf(valori_string[i],"%d",array_interi[i]); } while(len) { while(!(IFG2 & UCA0TXIFG)); // Wait for TX buffer to be ready for new data UCA0TXBUF = valori_string[k]; // Push data to TX buffer len--; // Update variables k++; } while(UCA0STAT & UCBUSY); // Wait until the last byte is completely sent }
questo èl'errore:
../main.c", line 47: error #515: a value of type "char *" cannot be assigned to an entity of type "unsigned char"
e questa è la riga
UCA0TXBUF = valori_string[k];
Ultima modifica effettuata da pocho183 04/06/14 15:50
aaa