ENC28J60 Interface with STM32 - Setting/Clearing Bits in Registers

Опубликовано: 17 Июль 2026
на канале: eXtreme Electronics
1,837
16

Now we will develop functions to set and clear bits in the register set of ENC28J60, these functions will latter help us in the development of the driver code.

View our other courses
https://avinash-s-school-6b36.thinkif...


Snippets:
void ENC28J60BitSet(uint8_t address, uint8_t mask)
{
uint8_t cmd=0;

cmd=0x80;//op-code

cmd=cmd|(address & 0x1F);//take only last 5 bits

ENC26J60_CS_Low();

SPIReadWrite(cmd);
SPIReadWrite(mask);

ENC26J60_CS_High();

}

void ENC28J60BitClear(uint8_t address, uint8_t mask)
{
uint8_t cmd=0;

cmd=0xA0;//op-code

cmd=cmd|(address & 0x1F);//take only last 5 bits

ENC26J60_CS_Low();

SPIReadWrite(cmd);
SPIReadWrite(mask);

ENC26J60_CS_High();
}