From 660dd4e8de7bf20b64c6ee5245343301f2dbf456 Mon Sep 17 00:00:00 2001 From: Marco Vitchi Thulin Date: Sun, 10 Mar 2024 16:42:23 +0100 Subject: [PATCH] Fix compilation errors Fixed an invalid bit read and added a missing semicolon. --- main.c | 123 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/main.c b/main.c index 26ea535..090ec41 100644 --- a/main.c +++ b/main.c @@ -14,20 +14,20 @@ void SendSPIDataADF4350 (uint32_t); int main() { // set instructions to configure the ADF4350 for a 1 GHz +5dBm output - uint32_t ar0=0x500000; - uint32_t ar1=0x8008011; - uint32_t ar2=0x4e42; - uint32_t ar3=0x4b3; - uint32_t ar4=0xac803c; - uint32_t ar5=0x580005; + uint32_t ar0=0x500000; + uint32_t ar1=0x8008011; + uint32_t ar2=0x4e42; + uint32_t ar3=0x4b3; + uint32_t ar4=0xac803c; + uint32_t ar5=0x580005; // alternative instructions for a 1001.25 MHz +5dBm output - //uint32_t ar0=0x500008; - //uint32_t ar1=0x8008029; - //uint32_t ar2=0x4e42; - //uint32_t ar3=0x4b3; - //uint32_t ar4=0xac803c; - //uint32_t ar5=0x580005; + //uint32_t ar0=0x500008; + //uint32_t ar1=0x8008029; + //uint32_t ar2=0x4e42; + //uint32_t ar3=0x4b3; + //uint32_t ar4=0xac803c; + //uint32_t ar5=0x580005; // set direction of PB1 (DO) and PB2 (USCK) as output DDRB=(1<> i) & 0x01; // write data bytes in Data register, will cause them to get sent on clock while(USIOIF==0) // check USI data counter overflow flag to detect the end of transmission every byte { USICR|=(1<> 8; uint8_t byte4 = outval & 0x000000FF; - // send these to the ADF4350 via SPI - SendReceiveSPIData (byte1); - SendReceiveSPIData (byte2); + // send these to the ADF4350 via SPI + SendReceiveSPIData (byte1); + SendReceiveSPIData (byte2); SendReceiveSPIData (byte3); SendReceiveSPIData (byte4); - // 2 x 16 version: - // split into 2 x 16 bit words + // 2 x 16 version: + // split into 2 x 16 bit words ///uint16_t highWord = (outval & 0xffff0000) >> 16; - ///uint16_t lowWord = outval & 0x0000ffff; - // send these to the ADF4350 via SPI - ///SendReceiveSPIData (highWord); - ///SendReceiveSPIData (lowWord); + ///uint16_t lowWord = outval & 0x0000ffff; + // send these to the ADF4350 via SPI + ///SendReceiveSPIData (highWord); + ///SendReceiveSPIData (lowWord); - // delay so the clock has gone low before LE is taken high - Delay(10); - // pull LE high to load the data into the ADF4350 register - PORTB |= (1 << PORTB3); - // short delay while LE is high (minimum of 20ns) - Delay(30); - // pull LE low again - PORTB &= ~(1 << PORTB3); + // delay so the clock has gone low before LE is taken high + Delay(10); + // pull LE high to load the data into the ADF4350 register + PORTB |= (1 << PORTB3); + // short delay while LE is high (minimum of 20ns) + Delay(30); + // pull LE low again + PORTB &= ~(1 << PORTB3); } \ No newline at end of file