Hopefully an easy problem
Posted: Thu Sep 10, 2009 2:51 am
Simple program in V4 using PIC16F88 with Internal Oscillator
2 delays / 2 LED macros to flash LED 0 on and off at 1 second intervals determined by delays
When building Hex get the following message:
Caution: Delay inaccurrate: 'delay_ms', Delay overhead:0ms, Unit delay:1.00016ms, Delay resolution:1 units
And on download to the PIC
Caution: Delay inaccurrate: 'delay_ms', Delay overhead:0ms, Unit delay:1.00016ms, Delay resolution:1 units
PIC does nothing - thanks for any help
C Code follows from Flowcode:
//************************************************************************************
//**
//** File name: C:\Documents and Settings\waldreng\My Documents\manuals\flowcode\Delaytest.c
//** Generated by: Flowcode v4.0.0.53
//** Date: Wednesday, September 09, 2009 22:15:56
//** Licence: Demo
//**
//** ***DEMO VERSION***
//**
//**
//** NOT FOR COMMERCIAL USE
//**
//** http://www.matrixmultimedia.com
//************************************************************************************
#define MX_PIC
//Defines for microcontroller
#define P16F88
#define MX_EE
#define MX_EE_TYPE2
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_B
#define MX_SPI_SDI 1
#define MX_SPI_SDO 2
#define MX_SPI_SCK 4
#define MX_UART
#define MX_UART_B
#define MX_UART_TX 5
#define MX_UART_RX 2
#define MX_I2C
#define MX_I2C_B
#define MX_I2C_SDA 1
#define MX_I2C_SCL 4
#define MX_PWM
#define MX_PWM_CNT 1
#define MX_PWM_TRIS1 trisb
#define MX_PWM_1 0
#define MX_PWM_TRIS1a trisb
#define MX_PWM_1a 3
//Functions
#include <system.h>
#pragma CLOCK_FREQ 19660800
//Configuration data
#pragma DATA 0x2007, 0x3f38
#pragma DATA 0x2008, 0x3ffc
//Internal functions
#include "C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h"
//Macro function declarations
//Variable declarations
char FCV_WHICHLED;
//Defines:
/**** Macro Substitutions ****
porta = LED Port Register
trisa = LED Data Direction Register
7 = Number of LEDs
1 = LED Pin 0
2 = LED Pin 1
4 = LED Pin 2
8 = LED Pin 3
16 = LED Pin 4
32 = LED Pin 5
64 = LED Pin 6
128 = LED Pin 7
******************************/
//LEDarray0: //Macro function declarations
void FCD_LEDarray0_LEDOn(char WhichLED);
void FCD_LEDarray0_LEDOff(char WhichLED);
//LEDarray0: //Macro implementations
void FCD_LEDarray0_LEDOn(char WhichLED)
{
char LEDMask;
if (WhichLED > 7)
{
LEDMask = 0;
}
else
{
switch (WhichLED)
{
case 0:
LEDMask = 1;
break;
case 1:
LEDMask = 2;
break;
case 2:
LEDMask = 4;
break;
case 3:
LEDMask = 8;
break;
case 4:
LEDMask = 16;
break;
case 5:
LEDMask = 32;
break;
case 6:
LEDMask = 64;
break;
case 7:
LEDMask = 128;
break;
}
}
trisa = trisa & ~LEDMask;
porta = porta | LEDMask;
}
void FCD_LEDarray0_LEDOff(char WhichLED)
{
char LEDMask;
if (WhichLED > 7)
{
LEDMask = 0;
}
else
{
switch (WhichLED)
{
case 0:
LEDMask = 1;
break;
case 1:
LEDMask = 2;
break;
case 2:
LEDMask = 4;
break;
case 3:
LEDMask = 8;
break;
case 4:
LEDMask = 16;
break;
case 5:
LEDMask = 32;
break;
case 6:
LEDMask = 64;
break;
case 7:
LEDMask = 128;
break;
}
}
trisa = trisa & ~LEDMask;
porta = porta & ~LEDMask;
}
//Macro implementations
void main()
{
//Initialisation
ansel = 0;
cmcon = 0x07;
//Interrupt initialisation code
option_reg = 0xC0;
//Calculation
//Calculation:
// WhichLED = 0
FCV_WHICHLED = 0;
//Loop
//Loop: While 1
while (1)
{
//Call Component Macro
//Call Component Macro: LEDarray(0)::LEDOff(WhichLED)
FCD_LEDarray0_LEDOff(FCV_WHICHLED);
//dumb
//Delay: 1 s
delay_s(1);
//Call Component Macro
//Call Component Macro: LEDarray(0)::LEDOn(WhichLED)
FCD_LEDarray0_LEDOn(FCV_WHICHLED);
//Delay
//Delay: 1 s
delay_s(1);
}
mainendloop: goto mainendloop;
}
void interrupt(void)
{
}
2 delays / 2 LED macros to flash LED 0 on and off at 1 second intervals determined by delays
When building Hex get the following message:
Caution: Delay inaccurrate: 'delay_ms', Delay overhead:0ms, Unit delay:1.00016ms, Delay resolution:1 units
And on download to the PIC
Caution: Delay inaccurrate: 'delay_ms', Delay overhead:0ms, Unit delay:1.00016ms, Delay resolution:1 units
PIC does nothing - thanks for any help
C Code follows from Flowcode:
//************************************************************************************
//**
//** File name: C:\Documents and Settings\waldreng\My Documents\manuals\flowcode\Delaytest.c
//** Generated by: Flowcode v4.0.0.53
//** Date: Wednesday, September 09, 2009 22:15:56
//** Licence: Demo
//**
//** ***DEMO VERSION***
//**
//**
//** NOT FOR COMMERCIAL USE
//**
//** http://www.matrixmultimedia.com
//************************************************************************************
#define MX_PIC
//Defines for microcontroller
#define P16F88
#define MX_EE
#define MX_EE_TYPE2
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_B
#define MX_SPI_SDI 1
#define MX_SPI_SDO 2
#define MX_SPI_SCK 4
#define MX_UART
#define MX_UART_B
#define MX_UART_TX 5
#define MX_UART_RX 2
#define MX_I2C
#define MX_I2C_B
#define MX_I2C_SDA 1
#define MX_I2C_SCL 4
#define MX_PWM
#define MX_PWM_CNT 1
#define MX_PWM_TRIS1 trisb
#define MX_PWM_1 0
#define MX_PWM_TRIS1a trisb
#define MX_PWM_1a 3
//Functions
#include <system.h>
#pragma CLOCK_FREQ 19660800
//Configuration data
#pragma DATA 0x2007, 0x3f38
#pragma DATA 0x2008, 0x3ffc
//Internal functions
#include "C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h"
//Macro function declarations
//Variable declarations
char FCV_WHICHLED;
//Defines:
/**** Macro Substitutions ****
porta = LED Port Register
trisa = LED Data Direction Register
7 = Number of LEDs
1 = LED Pin 0
2 = LED Pin 1
4 = LED Pin 2
8 = LED Pin 3
16 = LED Pin 4
32 = LED Pin 5
64 = LED Pin 6
128 = LED Pin 7
******************************/
//LEDarray0: //Macro function declarations
void FCD_LEDarray0_LEDOn(char WhichLED);
void FCD_LEDarray0_LEDOff(char WhichLED);
//LEDarray0: //Macro implementations
void FCD_LEDarray0_LEDOn(char WhichLED)
{
char LEDMask;
if (WhichLED > 7)
{
LEDMask = 0;
}
else
{
switch (WhichLED)
{
case 0:
LEDMask = 1;
break;
case 1:
LEDMask = 2;
break;
case 2:
LEDMask = 4;
break;
case 3:
LEDMask = 8;
break;
case 4:
LEDMask = 16;
break;
case 5:
LEDMask = 32;
break;
case 6:
LEDMask = 64;
break;
case 7:
LEDMask = 128;
break;
}
}
trisa = trisa & ~LEDMask;
porta = porta | LEDMask;
}
void FCD_LEDarray0_LEDOff(char WhichLED)
{
char LEDMask;
if (WhichLED > 7)
{
LEDMask = 0;
}
else
{
switch (WhichLED)
{
case 0:
LEDMask = 1;
break;
case 1:
LEDMask = 2;
break;
case 2:
LEDMask = 4;
break;
case 3:
LEDMask = 8;
break;
case 4:
LEDMask = 16;
break;
case 5:
LEDMask = 32;
break;
case 6:
LEDMask = 64;
break;
case 7:
LEDMask = 128;
break;
}
}
trisa = trisa & ~LEDMask;
porta = porta & ~LEDMask;
}
//Macro implementations
void main()
{
//Initialisation
ansel = 0;
cmcon = 0x07;
//Interrupt initialisation code
option_reg = 0xC0;
//Calculation
//Calculation:
// WhichLED = 0
FCV_WHICHLED = 0;
//Loop
//Loop: While 1
while (1)
{
//Call Component Macro
//Call Component Macro: LEDarray(0)::LEDOff(WhichLED)
FCD_LEDarray0_LEDOff(FCV_WHICHLED);
//dumb
//Delay: 1 s
delay_s(1);
//Call Component Macro
//Call Component Macro: LEDarray(0)::LEDOn(WhichLED)
FCD_LEDarray0_LEDOn(FCV_WHICHLED);
//Delay
//Delay: 1 s
delay_s(1);
}
mainendloop: goto mainendloop;
}
void interrupt(void)
{
}