Go to the source code of this file.
Macros | |
| #define | bitArrayLength 58 |
| #define | bitTime0Sec 0.1 |
| #define | bitTime1Sec 0.2 |
| #define | bitTimeSyncSec 1.8 |
| #define | bitTimeCyclesTresh 0.01 |
| #define | bitTimeCycles0 ((clockFreq) * (bitTime0Sec)) |
| #define | bitTimeCycles0Upper ((int)((bitTimeCycles0) + ((clockFreq) * (bitTimeCyclesTresh)))) |
| #define | bitTimeCycles0Lower ((int)((bitTimeCycles0) - ((clockFreq) * (bitTimeCyclesTresh)))) |
| #define | bitTimeCycles1 ((clockFreq) * (bitTime1Sec)) |
| #define | bitTimeCycles1Upper ((int)((bitTimeCycles1) + ((clockFreq) * (bitTimeCyclesTresh)))) |
| #define | bitTimeCycles1Lower ((int)((bitTimeCycles1) - ((clockFreq) * (bitTimeCyclesTresh)))) |
| #define | bitTimeCyclesSync ((unsigned int)(clockFreq * bitTimeSyncSec)) |
| #define | bitTimeCyclesSyncUpper ((unsigned int)(bitTimeCyclesSync + (clockFreq * bitTimeCyclesTresh))) |
| #define | bitTimeCyclesSyncLower ((unsigned int)(bitTimeCyclesSync - (clockFreq * bitTimeCyclesTresh))) |
Functions | |
| unsigned int | calculateBitTransmitTime (bool checkSyncStatus, unsigned int start, bool startDir, unsigned int stop, bool stopDir) |
| Calculate the bit time of the DCF77 pulses, gets called from interruptDcf() | |
| bool | bitValue (unsigned int bitTime) |
| Determine the bit value of the transmitted DCF77 bit and return it, gets called from interruptDcf() | |
| void | storeBit (bool bit, unsigned int location) |
| Store the received DCF77 bit in the array, gets called from interruptDcf() | |
| void | decodeBitStream2Seconds () |
| Decode the received DCF77 bitstream to a time, gets called from interruptDcf() Also ensure that the received time is plausible by a couple of checks. | |
| bool | checkBitStream () |
| Checks if certain predetermined bits are 1 or 0 and if parity of minute and hour is correct, gets called from interruptDcf() | |
| void | interruptDcf () |
| Time the DCF77 pulses gets called from pin interrupt port1ISR(void) | |
Variables | |
| bool | interruptEdgeToggleDcf |
| unsigned int | startTime |
| bool | countingDirectionStart |
| unsigned int | endTime |
| bool | countingDirectionEnd |
| bool | currentBit |
| bool | bitArray [60] |
| bool | toggleInterruptDcf |
| volatile unsigned int | minuteDcfLast |
| volatile unsigned int | hourDcfLast |
| uint32_t | countDcf77Messages |
| #define bitArrayLength 58 |
Definition at line 21 of file dcfReceive.h.
Referenced by interruptDcf().
| #define bitTime0Sec 0.1 |
Definition at line 27 of file dcfReceive.h.
| #define bitTime1Sec 0.2 |
Definition at line 28 of file dcfReceive.h.
| #define bitTimeCycles0 ((clockFreq) * (bitTime0Sec)) |
Definition at line 34 of file dcfReceive.h.
| #define bitTimeCycles0Lower ((int)((bitTimeCycles0) - ((clockFreq) * (bitTimeCyclesTresh)))) |
Definition at line 36 of file dcfReceive.h.
Referenced by bitValue().
| #define bitTimeCycles0Upper ((int)((bitTimeCycles0) + ((clockFreq) * (bitTimeCyclesTresh)))) |
Definition at line 35 of file dcfReceive.h.
Referenced by bitValue().
| #define bitTimeCycles1 ((clockFreq) * (bitTime1Sec)) |
Definition at line 38 of file dcfReceive.h.
| #define bitTimeCycles1Lower ((int)((bitTimeCycles1) - ((clockFreq) * (bitTimeCyclesTresh)))) |
Definition at line 40 of file dcfReceive.h.
Referenced by bitValue().
| #define bitTimeCycles1Upper ((int)((bitTimeCycles1) + ((clockFreq) * (bitTimeCyclesTresh)))) |
Definition at line 39 of file dcfReceive.h.
Referenced by bitValue().
| #define bitTimeCyclesSync ((unsigned int)(clockFreq * bitTimeSyncSec)) |
Definition at line 42 of file dcfReceive.h.
| #define bitTimeCyclesSyncLower ((unsigned int)(bitTimeCyclesSync - (clockFreq * bitTimeCyclesTresh))) |
Definition at line 44 of file dcfReceive.h.
| #define bitTimeCyclesSyncUpper ((unsigned int)(bitTimeCyclesSync + (clockFreq * bitTimeCyclesTresh))) |
Definition at line 43 of file dcfReceive.h.
| #define bitTimeCyclesTresh 0.01 |
Definition at line 30 of file dcfReceive.h.
| #define bitTimeSyncSec 1.8 |
Definition at line 29 of file dcfReceive.h.
| bool bitValue | ( | unsigned int | bitTime | ) |
Determine the bit value of the transmitted DCF77 bit and return it, gets called from interruptDcf()
| bitTime | Time of the bit signal in timer cycles |
Definition at line 154 of file dcfReceive.c.
References bitTimeCycles0Lower, bitTimeCycles0Upper, bitTimeCycles1Lower, and bitTimeCycles1Upper.
Referenced by interruptDcf().
| unsigned int calculateBitTransmitTime | ( | bool | checkSyncStatus, |
| unsigned int | start, | ||
| bool | startDir, | ||
| unsigned int | stop, | ||
| bool | stopDir ) |
Calculate the bit time of the DCF77 pulses, gets called from interruptDcf()
Calculate the time it took between the rising and falling edge of the DCF77 pulse Take in to account the up and down behavior of the timer
| checkSyncStatus | (unused in this function). |
| start | The start point of the transmission on the timer up/down counter. |
| startDir | The direction of the start point (1 for up, 0 for down). |
| stop | The stop point of the transmission. |
| stopDir | The direction of the stop point (1 for up, 0 for down). |
Definition at line 120 of file dcfReceive.c.
References capacityTimer.
Referenced by interruptDcf().
| bool checkBitStream | ( | ) |
Checks if certain predetermined bits are 1 or 0 and if parity of minute and hour is correct, gets called from interruptDcf()
Definition at line 188 of file dcfReceive.c.
References bitArray, UART_Bitstream(), and UART_SendString().
Referenced by interruptDcf().
| void decodeBitStream2Seconds | ( | ) |
Decode the received DCF77 bitstream to a time, gets called from interruptDcf() Also ensure that the received time is plausible by a couple of checks.
Definition at line 262 of file dcfReceive.c.
References bitArray, countDcf77Messages, hourDcfLast, mechanicalTimeFloat, minuteDcfLast, timeOfLastDcfMessage, timeSinceLastCompleteDcfMessage, UART_Bitstream(), UART_SendInt(), UART_SendString(), and UART_SendTime().
Referenced by interruptDcf().
| void interruptDcf | ( | ) |
Time the DCF77 pulses gets called from pin interrupt port1ISR(void)
Wait first for sync pulse than read out each of 59 bits Determine the value of the bit with: bool bitValue() based on the calculated transmit time with: unsigned int calculateBitTransmitTime() Store the result via: storeBit(), when all 59 bits are received check with: checkBitStream(), and decode to time: decodeBitStream2Seconds()
Definition at line 26 of file dcfReceive.c.
References bitArrayLength, bitValue(), calculateBitTransmitTime(), checkBitStream(), countingDirectionEnd, countingDirectionStart, currentBit, decodeBitStream2Seconds(), endTime, interruptEdgeToggleDcf, startTime, storeBit(), testbitTimeCyclesStartLower, testbitTimeCyclesStartUpper, toggleTimer1Direction, and UART_SendString().
Referenced by port1ISR().
| void storeBit | ( | bool | bit, |
| unsigned int | location ) |
Store the received DCF77 bit in the array, gets called from interruptDcf()
| [in] | bit | The value of the bit |
| [in] | location | The location of the array to store the bit |
Definition at line 178 of file dcfReceive.c.
References bitArray.
Referenced by interruptDcf().
| bool bitArray[60] |
Definition at line 22 of file dcfReceive.h.
Referenced by checkBitStream(), decodeBitStream2Seconds(), and storeBit().
| uint32_t countDcf77Messages |
Definition at line 49 of file dcfReceive.h.
Referenced by ADC10_ISR(), calculateTimeDifference(), decodeBitStream2Seconds(), and port1ISR().
| bool countingDirectionEnd |
Definition at line 19 of file dcfReceive.h.
Referenced by interruptDcf().
| bool countingDirectionStart |
Definition at line 17 of file dcfReceive.h.
Referenced by interruptDcf().
| bool currentBit |
Definition at line 20 of file dcfReceive.h.
Referenced by interruptDcf().
| unsigned int endTime |
Definition at line 18 of file dcfReceive.h.
Referenced by interruptDcf().
| volatile unsigned int hourDcfLast |
Definition at line 47 of file dcfReceive.h.
Referenced by decodeBitStream2Seconds().
| bool interruptEdgeToggleDcf |
Definition at line 15 of file dcfReceive.h.
Referenced by interruptDcf().
| volatile unsigned int minuteDcfLast |
Definition at line 46 of file dcfReceive.h.
Referenced by decodeBitStream2Seconds().
| unsigned int startTime |
Definition at line 16 of file dcfReceive.h.
Referenced by interruptDcf().
| bool toggleInterruptDcf |
Definition at line 24 of file dcfReceive.h.
Referenced by calculateTimeDifference(), and port1ISR().