A
alkid
Guest
Mogao izvorni kod za pisano za c8051F320 se koristiti za c8051F120?
void Test_TX (void)
(
LED1 Led2 = = = Led3 Led4 = 1; / / Clear status LED
SPI_RW_Reg (WRITE_REG SETUP_AW, (TX_AW-2)); / / Postavljanje RX / TX adresu širina
SPI_Write_Buf (WRITE_REG TX_ADDR, TX_ADDRESS_, TX_AW); / / Piše TX_Addr
SPI_Write_Buf (WRITE_REG RX_ADDR_P0, RX_ADDRESS_, RX_AW); / / Piše RX_Addr, Pipe0 za auto.ack
SPI_Write_Buf (WR_TX_PLOAD, TX_PAYLOAD_, TX_PL_W); / / TX piše nosivost
SPI_RW_Reg (WRITE_REG STATUS, 0x70); / / Pročitajte statusa i jasan IRQ zastavu's
SPI_RW_Reg (WRITE_REG EN_AA, 0x01); / / Enable Auto ACK pipe0
SPI_RW_Reg (WRITE_REG EN_RXADDR, 0x01); / / Enable pipe0
SPI_RW_Reg (WRITE_REG SETUP_RETR, 0x0A); / / 250ľs ls 86, 10 retrans ...
SPI_RW_Reg (WRITE_REG RF_CH, 40); / / Kanal 40
SPI_RW_Reg (WRITE_REG CONFIG, 0x0e); / / PWR_UP, CRC (2bytes) i prim: TX.
dok je (! SW1); / / čekati SW1 pušten
LED1 = 0; / / LED1 ukazuje TX modu
EX0 = 1; / / Enable Vanjski Interrupt0
)
void Test_TX (void)
(
LED1 Led2 = = = Led3 Led4 = 1; / / Clear status LED
SPI_RW_Reg (WRITE_REG SETUP_AW, (TX_AW-2)); / / Postavljanje RX / TX adresu širina
SPI_Write_Buf (WRITE_REG TX_ADDR, TX_ADDRESS_, TX_AW); / / Piše TX_Addr
SPI_Write_Buf (WRITE_REG RX_ADDR_P0, RX_ADDRESS_, RX_AW); / / Piše RX_Addr, Pipe0 za auto.ack
SPI_Write_Buf (WR_TX_PLOAD, TX_PAYLOAD_, TX_PL_W); / / TX piše nosivost
SPI_RW_Reg (WRITE_REG STATUS, 0x70); / / Pročitajte statusa i jasan IRQ zastavu's
SPI_RW_Reg (WRITE_REG EN_AA, 0x01); / / Enable Auto ACK pipe0
SPI_RW_Reg (WRITE_REG EN_RXADDR, 0x01); / / Enable pipe0
SPI_RW_Reg (WRITE_REG SETUP_RETR, 0x0A); / / 250ľs ls 86, 10 retrans ...
SPI_RW_Reg (WRITE_REG RF_CH, 40); / / Kanal 40
SPI_RW_Reg (WRITE_REG CONFIG, 0x0e); / / PWR_UP, CRC (2bytes) i prim: TX.
dok je (! SW1); / / čekati SW1 pušten
LED1 = 0; / / LED1 ukazuje TX modu
EX0 = 1; / / Enable Vanjski Interrupt0
)