Skip to content

Commit

Permalink
funcions
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Mar 31, 2014
1 parent 170e376 commit b5a7236
Showing 1 changed file with 46 additions and 20 deletions.
66 changes: 46 additions & 20 deletions beacon/coded.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,51 @@
#include <pic14\pic16f876.h>
#include <stdint.h> //Needed for uint16_t

#define DIT 2000
#define DA 6000
// Configurations
static __code uint16_t __at (0x2007) config = _HS_OSC & _PWRTE_ON & _BODEN_OFF & _WDT_OFF & _LVP_OFF;

unsigned int delayCount = 0;
void dit()
{
while ( delayCount < DIT ) // Delay Loop
{
delayCount++;
}
delayCount = 0; // reset counter
// port off
PORTB = 0x00;

// delay while off
while ( delayCount < DIT ) // Delay Loop
{
delayCount++;
}
delayCount = 0; // reset counter
// port on
PORTB = 0x01;
}
void da()
{
while ( delayCount < DA ) // Delay Loop
{
delayCount++;
}
delayCount = 0; // reset counter
// port off
PORTB = 0x00;

// delay while off
while ( delayCount < DA ) // Delay Loop
{
delayCount++;
}
delayCount = 0; // reset counter
// port on
PORTB = 0x01;
}


// Main body
void main() {

Expand All @@ -20,23 +61,8 @@ void main() {
PORTB = 0x01;
// keep repeating
while(1) {
// delay while on
while ( delayCount < 4000 ) // Delay Loop
{
delayCount++;
}
delayCount = 0; // reset counter
// port off
PORTB = 0x00;

// delay while off
while ( delayCount < 4000 ) // Delay Loop
{
delayCount++;
}
delayCount = 0; // reset counter
// port on
PORTB = 0x01;

dit();
da();
}
}
}

0 comments on commit b5a7236

Please sign in to comment.