Pommie said:I have had pics go a bit faulty in the past. I had a 16F886 and it's internal oscillator ran at 5.3MHz instead of 8. Have you a Maplin nearby where you could get a new one and at least eliminate the chip.
Mike.
bigal_scorpio said:Hi Eric and HTH,
bigal_scorpio said:I have a few PICs laying around, but to me the problem of changing the code is insurmountable...
...The problem with changing the programming is stopping me from using a different PIC, but maybe you know what I should change, and maybe could help me out.
Thanks again guys...........Al
//
// Rev counter
//
#include <P16f84.h>
#include <displays.h>
//
// Define software version strings
const unsigned char VersionString1[]="V1.02";
const unsigned char VersionString2[]="19/02/2006";
#include "RevCount-vars.h"
// FUNCTION PROFORMAS
void clearLCD(); //Clear LCD display
void LCDNum(); //Output 5-digit revCount number to LCD
void Interrupt(); //Interrupt handler
//Time delay
void waitTime(unsigned int time);
//MAIN
//
void main ()
{
//Initialise Port A
TRISA=0x17; //Set all bits of Port A to input
// Initialize the LCD with startup message
waitTime(1000); //Wait a bit
LCD(-2); //2-line display, 8-bit, 5x7 format
clearLCD(); //Initialize & clear screen
LCDPrintAt(0,0); //2nd message
LCDString("RevMaster"); //Hello to the world
LCDPrintAt(0,1); //2nd line
LCDString (VersionString1); //Display software version
waitTime(32767); //Wait some more
LCDPrintAt(0,1); //2nd line
LCDString (VersionString2); //Display software date
waitTime(32767); //Wait some more
LCDPrintAt(0,1); //2nd line
zeros=5; //assume 1ppr and therefore 1 trailing zero
scale=6; //...and scale result by 6
if (PA.B0==0)
{
LCDString("06"); //6 marks per rev
zeros=5; //...therefore 1 trailing zero
scale=1; //...and scale by 1
}
else if (PA.B1==0)
{
LCDString("60"); //60 marks per rev
zeros=6; //...therefore 0 trailing zeros
scale=1; //...and scale by 1
}
else LCDString("00"); //60 marks per rev
LCDString(" PPR "); //
waitTime(32767); //Wait a bit
LCDPrintAt(0,1); //2nd message
LCDString(" 0 RPM"); //assume 1 mark per rev
LCD(0x104); //Force reverse cursor for number printing
//Initialise Port B and Interrupt settings
TRISB=0x01; //Set bits 1 to 7 of Port B to output,
//bit 0 to input
OPTION_REG=0x85; //Pull ups on B, TMR0 internal, 64 prescale
INTCON|=(1<<T0IE)|(1<<GIE)|(1<<INTE);
//Enable interrupts for TMR0 & INTE
// MAIN CONTROL LOOP - Select major mode & execute that mode's behaviour
while(1) //Loop forever
{
if (timeInt) //If there has been a 1/10th second interrupt
{
timeInt=0; //Clear the int flag
actual=countHi;
actual=(actual<<8)+countLo;
//Get the count value
countLo=0; //Clear the count value
countHi=0;
actual=actual*scale; //Scale the value by 1 or 6
LCDNum(); //Print the value
LCDPrintAt(16,1); //Lose the cursor
}
}
};
//
// Waittime function - waits for a specified delay period.
//
void waitTime(unsigned int time)
{
while(time--) ; //Repeat loop time times
};
//
// LCD Clear function
//
void clearLCD()
{
LCD(0x108); //Display off
LCD(0x101); //Clear display, cursor home
LCD(0x10f); //Display on, cursor on, flash cursor
LCD(0x180); //Print position 0,0
};
//
// LCDNum function - prints 4 digit revCount to LCD display (backwards)
// Includes decimal point if the point parameter is within range of digits
//
void LCDNum()
{
char digits;
LCD((int)zeros-1+0x180+0x40); //Print position zeros,0
for(digits=5; digits; digits--)
{
LCD((actual%10)+'0'); //Print Nth digit
actual/=10; //lose Nth digit
}
};
//
//Interrupt handler
//Interrupt generated every 1/50 secs by timer 0
//and every time a pulse is detected on Port B bit 0
//
const int QuickInt=1; // Flag use of quick interrupts
void Interrupt()
{
#asm
btfss INTCON,INTF ; If tacho interrupt...
goto noTach
incfsz countLo ; Increment low count
goto clearTach
incf countHi ; Increment high count if necessary
clearTach:
bcf INTCON,INTF ; Clear tacho interrupt...
noTach:
btfss INTCON,T0IF ; If timer interrupt...
goto noTimer
decfsz sec ; Decrement seconds count
goto clearTimer
movlw 1
movwf timeInt ; Signal a timer interrupt
movlw 50
movwf sec ; Re-prime the timer
clearTimer:
bcf INTCON,T0IF ; Clear timer interrupt...
noTimer:
#asmend
}
The hex file doesn't contain config data.Mickster said:Al,
e.g. Your 3BF9 & 3BFF translate to 11101111111001 and 11101111111111 respectively. From the datasheet, you will note that 3BF9 disables the WDT and selects XT (external crystal) oscillator, whereas 3BFF enables the WDT and selects RC (Resistor Capacitor) oscillator. The PCB layout in the linked PDF has an external crystal oscillator (XT) and the supplied hex file most likely contains 3BFF, but having the choice to select differing config options, within the main screen of PicProg2006, has probably led to the confusion.
mike50 said:The hex file doesn't contain config data.
Clearly WDT needs to be disabled, as the source shown never clears the WDT.
So the 3BF9 makes more sense than 3BFF.
Mike
mike50 said:The hex file doesn't contain config data.
ORG 0x2007
DATA 0x1F
Mickster said:
Firstly, I'll get this bit out of the way...I'm still a noob, but hope to gradually change this status.I'm not here to pick an argument, but the quote above differs from what I had initially thought, along with what I have just pulled up on 'the net'.
For instance, the datasheet for this PIC lists the Config bits in address 2007h and a disassembly (Using IC-Prog) of the .HEX file shows:
Code:ORG 0x2007 DATA 0x1F
toward the end of the file.
Also, in this link:
https://books.google.co.uk/books?id...aqeAfWy&sig=x4NkrWuUFv03EKV8Q1Td2pxw54U&hl=en
the first paragraph mentions Config fuses in the .HEX file.
Please can you expand on your statement?
Nigel Goodwin said:He didn't say ALL HEX files don't contain the config data, they can, and they should...
Nigel Goodwin said:... Presumably the particular file under discussion didn't contain config data, and the programmer should warn you when you load it (WinPicProg does).
ORG 0x2000
DATA 0x0F
DATA 0x0F
DATA 0x0F
DATA 0x0F
ORG 0x2007
DATA 0x1F
ORG 0x2100
DATA 0xFF
DATA 0xFF
DATA 0xFF
DATA 0xFF....
The hex file in question from the site identified in the original postMickster said:
Firstly, I'll get this bit out of the way...I'm still a noob, but hope to gradually change this status.I'm not here to pick an argument, but the quote above differs from what I had initially thought, along with what I have just pulled up on 'the net'.
For instance, the datasheet for this PIC lists the Config bits in address 2007h and a disassembly (Using IC-Prog) of the .HEX file shows:
Code:ORG 0x2007 DATA 0x1F
toward the end of the file.
Also, in this link:
http://books.google.co.uk/books?id=...aqeAfWy&sig=x4NkrWuUFv03EKV8Q1Td2pxw54U&hl=en
the first paragraph mentions Config fuses in the .HEX file.
Please can you expand on your statement?
contained no CONFIG data.bigal_scorpio said:The program I'm trying to use is the RevMaster Firmware Zip at http://www.jeffree.co.uk/pages/tachometer-pcbs.html
Mickster said:from the IC-Prog disassembly of the file under discussion indicate whether Config data is present within the HEX file?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?