Zadanie polega na zapisie "x" danych z portu szeregowego do 16-to bitowych rejestrów, oraz na odczycie tychże rejestrów. Żeby to uprościć chciałem wykorzystać wskaźniki. Program się wykłada w poleceniu "wsk_rejestr=&rejestr;" komunikatem "Error: a value of type 'unsigned int [255] *' can't be assigned to an entity of type 'unsigned int *' ". Jak prawidłowo można wykorzystać wskaźnik w tym celu?
Czy ktoś mógłby pomóc?
Proszę łaskawie zapoznać się , z p.11.1 regulaminu - tytuł poprawiłem.
[zumek]
typedef unsigned char u8;
unsigned int rejestr[255];
unsigned int *wsk_rejestr;
void zapisz_dane_do_rejestru(u8 adres startowy,u8 ilosc)
{
unsigned char x;
wsk_rejestr=&rejestr;
for (x=0;x<ilosc;x++)
{
// rejestr[adres startowy+x]= rx_buffer[10+(x<<1)];
// rejestr[adres startowy+x]=(rejestr[adres startowy]<<8)+ramka_in[11+(x<<1)];
}
}
void odczytaj_dane_z_rejestru(u8 adres startowy,u8 ilosc)
{
unsigned char x;
tx_buffer[2]=(ilosc<<1);
tx_wr_index=3;
for (x=0;x<ilosc;x++)
{
// tx_buffer[tx_wr_index++]= (unsigned char)(rejestr[adres startowy+x] >> 8);
// tx_buffer[tx_wr_index++]= (unsigned char)(rejestr[adres startowy+x]&0xFF);
}
}
Czy ktoś mógłby pomóc?
Proszę łaskawie zapoznać się , z p.11.1 regulaminu - tytuł poprawiłem.
[zumek]
