Hi Guys, I've been using a PIC16F684 for some years in my model plane projects. Now that I can't get any more......easily, I was told by Microchip that I should change to the 16F18324 as it is "basically" the same. Hmmm....it isn't! There are many differences that I just can't figure out. Just as an example I'm trying to use Timer 0 for something so I wrote this short test program which works on my 16F684:
'PIC 16F684 Timer tester by Keith Renecle May 2022
#chip16F18324,16
#configOsc=INT
#defineLEDPORTC.3DirLEDOutInitTimer0Osc,PS0_1/256Start:
TMR0=0Wait10ms'time this valueEPWrite(0, TMR0)PulseOut LED, 250 msend
Forgive the huge "# config statements".
I would appreciate any help. Thanks.
Keith R
Last edit: Anobium 2023-07-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Keith - they recommended a newer chip, As you have discovered.. the new chip is not the same it is truly different. It is the best upgrade but many things are different.
As you did not post reference program for the 16F684 ... I am now in guessing mode,
The max frequency of the 684 was 8. What frequency did you use?
What results are you expecting? You will get a value in EE but it will be different from the 684 as the frequency is different. Did the LED pulse for 250 ms? Did the EE write fail? Update to latest compiler before answering.
What compiler are you using? 684... you may be using a very old compiler that is no longer supported. I am using the very latest for the 18324 so my result will be different.
So, update to latest toolchain.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Anobium, thanks for the reply. I was running the 16F684 at 20MHz with an external crystal and the 2 caps on my pc board. I get 00 in RAM memory 0. It looks to me as if the timer is not running on the 16F18324. If I add a line "TMR0 = 100" for example, then it will stick 64 Hex in the memory. If I do this on the 20 MHz 684, then it shows 100 + 255 because it jumps over the 255 in that 20 ms timing. However on the 18324 nothing changes. It's as if the timer has not been initiated.
I downloaded the latest GC Studio two days ago because I was indeed using the 2021 version of Synwrite compilor, but it does exactly the same. In my old version of Synwrite, there are many demos, but in my latest GC Studio download, I only find 3 small files. Maybe I don't have the correct GC Studio download?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks again. Hmmm.........I'm getting too old (73) for these changes! Those demos just confuse me even more unfortunately. What happened to the configs from the old GCB programs?? I looked at a few of those demos using the 18326 chip, but they just don't make much sense to me and are mainly using the PWM stuff and not Timer 0.
Just btw, my 18324 program works fine on Timer 1, 2 etc. It's just Timer 0 that's catching me out. I'm running W7 on my desktop because it just works the way I like it. I have a fairly good laptop with W10, so I downloaded GC Studio just now from Sourceforge. It also doesn't work on my timer 0 program.
This is all for my control line model plane governor timer gadget that you guys have helped me with for quite a few years. I thought that it would be easy to just change the chip and re-do the differences in timing from 20 MHz to 16. Hmmm.....that was wishful thinking! I have a Run section and a Programming section in my software, and now pressing my Program button does not even jump to that section. It jumps back to the beginning of my program and it is just a simple GOTO statement. I obviously have a bum program that was tolerated by the old chip and compiler.
Quick question. I see that Synwrite sticks green lines after various sections of my program. What do they mean?
Oh.....one more admission. I have the old PicKit 2 which no longer worked with these modern chips, so I found the PicKitminus driver software. I looked at the PicKitPlus software but there were costs involved. I'm a pensioner living in Darkest Africa (South Africa) where our wonderful currency is worth peanuts. Not quite as bad as the Zimbabwe $, but getting there every day!
I did consider that it's the PicKitminus software that's the issue, but it works ok with my old programs and also the 18324 test programs besides the timer 0 program, so I don't think that this is my problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
. I'm a pensioner living in Darkest Africa (South Africa) where our wonderful currency is worth peanuts.
That makes 2 of us Keith.
I am not sure I have any 16F18324 devices, I havn't bother to get any samples for the past few years so am a bit out of touch, but I did create the Millis Library which uses Timer 0 and we tested it extensively across the supported devices. I don't recall if we tested the 16F18324 specifically though.
Where are you based?
I am in Cape Town.
Cheers
Chris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried various things now, and I'm fairly convinced (?) that I'm simply not initializing Timer 0. My statement "InitTimer0 Osc, PS0_1/256" does not seem to work with the 18324. Is there some new way of doing this on this chip for Timer 0? Maybe because it is a 8 or 16 bit timer, I need to select this somehow, but I can't figure it out from the data sheet.
Here is my similar program for Timer 2 testing and like I say, it works just fine.
'PIC 16F684 Timer 2 tester by Keith Renecle May 2022
chip 16F18324, 16
config Osc = Int
define LED PORTC.3
Dir LED Out
InitTimer2 Osc, PS2_1/4
Start:
ClearTimer 2
StartTimer 2
Wait 22 ms 'time this value
StopTimer 2
EPWrite(0, TMR2)
wait 20 ms
PulseOut LED, 250 ms
end
Last edit: Keith Renecle 2023-07-26
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I know you are not setting up the timer correctly. Look at demo 18. It shows how to setup the Timer0,
Re PICKitMinus. It is total plagiarism of my works. He has taken my works and claimed as his. He has not attributed my work. I spent years getting PICKitPlus quality correct to have that happen.
The money required to obtain PICKItPlus gives you support. Support that is better than Microchips. PICKItPlus is an aproved Software Partnet of Microchip.
I am a pensioner also.
Yes, I am not happy about PICKitMinus.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Humble apologies, I did not know that you were the guy that does the PicKitPlus software. I mean no disrespect and always appreciate the help from this forum. However, I do get ticked off when companies like Microchip make their products obsolete. I have two PicKit2 programmers that are useless without this extra driver software, and my small project is basically all I use PIC's for. I have a bunch of pc boards with the new 18324 on them with smd parts, so I'm not working with a plug-in chip to play with. The board has inputs and outputs, one being an LED and this allows me to try with small programs to see what's going on. My previous board was designed for the PIC16F684-I/ST which is the tiny 14 pin TSSOP version. Now that I can no longer buy these chips easily, or cheaply, I ordered boards with the 18324 chips on them.
My main problem is that I just cannot figure out why I can't use the same terminology and configs for the 18324. You send me links to demos but they don't explain these details properly and my project is not the same. I look at the documentation on GC Studio, under timers and the syntax for initializing Timer0 is "InitTimer0 source, prescaler". Then in the sample program it says the following:
'Set up the timer using the internal oscillator with a prescaler of 1/2 (Equates to 0)
'Timer 0 starts automatically on a Microchip PIC microcontroller, therefore, StartTimer is not required.
InitTimer0 Osc, PS0_2
Hmmm, in the #18 demo, they use StartTimer 0!
Now that's all fine and dandy, but it no longer works like this, so what has changed? Here is the line in that demo#18 that you suggest:
InitTimer0 Osc, PRE0_16384 + TMR0_HFINTOSC, POST0_11
So now the "InitTimer0 Osc" is fine, but what does "PRE0_16384 + TMR0_HFINTOSC" mean? It seems that PRE0 is now for the prescaler, but why 16384 + TMR0_HFINTOSC? I understand that POST0_11 must be a post-scaler setting.
Hopefully you're not too pissed off with me to help me some more? If there is a more recent tutorial on using these timers on the new chips with GCB, then maybe you could point me to that. I also need to know what the green line that pops up in Synwrite shows. Thanks very much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Humble apologies, I did not know that you were the guy that does the PicKitPlus software. I mean no disrespect and always appreciate the help from this forum.
Do not be humble - please. Understand.
I am the same person. I used the funds from PICKITPlus to help support GCBASIC.
Cost for GCBASIC will be approx £600 GBP. I will be looking for donations in November.
PICKITPlus and GCBASIC are not free to provide the costs are rising and rising.
GCBASIC - this is Open Source but someone has to pay the bills and I expecti donations to cover the costs, to the greatest extent.
PICKITPLUS - this is a huge development program and the licenses pay the cost of the developer, hosting and services. Any think left over goes into the GCBASIC fund.
Why the difference ? GCBASIC is always going to free to obtain and with a donation model. PICKITPLUS is used by many more comnpilers for many different uses and therefore a license model is applicable.
Having someone take the PICKITPLUS database and plagerise the work upsets the overall model. I tried to give him all the source and agree a model going forward but he just broke things.
PICKITMINUS - it can and it will get out of support. He used the 223 version of the database. We are now on 237 with many new chips and 100s of fixes. If he takes this database then I will take legal action against him.
However, I do get ticked off when companies like Microchip make their products obsolete. I have two PicKit2 programmers that are useless without this extra driver software, and my small project is basically all I use PIC's for.
The PICKit2 or the PICKit3 is not obsolete. Microchip does not provide technival support for them. Microchip supports PK2 and PK3 etc in the MPLAB-X Development tools. The CEO made a clear statement of legacy support in March 2022.
PICKit2 / PICKit3 support is provide by PICKITPLUS, as a Microchip Support Partner. Having a license for PICKITPLUS enables the support.
I have a bunch of pc boards with the new 18324 on them with smd parts, so I'm not working with a plug-in chip to play with. The board has inputs and outputs, one being an LED and this allows me to try with small programs to see what's going on. My previous board was designed for the PIC16F684-I/ST which is the tiny 14 pin TSSOP version. Now that I can no longer buy these chips easily, or cheaply, I ordered boards with the 18324 chips on them.
The assumption the 18324 was a similar chip may have been an over simplication. The DEMOS show the differences. It would simple to create the same demos for the 684 to show these differences - they include PMW Setup, Serial Setup, Timer Setup etc and the register names are different acrosss many functional areas.
My main problem is that I just cannot figure out why I can't use the same terminology and configs for the 18324.
They are different chips hence the different terminology.
You send me links to demos but they don't explain these details properly and my project is not the same. I look at the documentation on GC Studio, under timers and the syntax for initializing Timer0 is "InitTimer0 source, prescaler". Then in the sample program it says the following:
'Set up the timer using the internal oscillator with a prescaler of 1/2 (Equates to 0)
'Timer 0 starts automatically on a Microchip PIC microcontroller, therefore, StartTimer is not required.
InitTimer0 Osc, PS0_2
Hmmm, in the #18 demo, they use StartTimer 0!
Now that's all fine and dandy, but it no longer works like this, so what has changed? Here is the line in that demo#18 that you suggest:
InitTimer0 Osc, PRE0_16384 + TMR0_HFINTOSC, POST0_11
So now the "InitTimer0 Osc" is fine, but what does "PRE0_16384 + TMR0_HFINTOSC" mean? It seems that PRE0 is now for the prescaler, but why 16384 + TMR0_HFINTOSC? I understand that POST0_11 must be a post-scaler setting.
Hopefully you're not too pissed off with me to help me some more?
I have been involved with GCBASIC for a long time. This is not water of ducks back but I hope the few pounds that you will provide to support GCBASIC or to buy a license for PICKITPLUS are the only way these projects will remain operation.
Cus, when I stop do this. Both projects may suffer.
If there is a more recent tutorial on using these timers on the new chips with GCB, then maybe you could point me to that. I also need to know what the green line that pops up in Synwrite shows. Thanks very much.
There are a many YouTube videos on my channel. Specificially, the 18326 ( a sister chip ) and therefore the tuturials are very applicable to your use case.
Evan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks again Evan, I now fully understand your explanation of all of this. I'm a casual user and a lousy programmer to boot, so I only use PIC chips or any programming occasionally. I'm a retired electronics technician by trade, but that was with analogue stuff. I was quite happy with my project and the old 16F684 and would have carried on making my gadget here and there as it was for a while longer but since 2020 the world changed and now the old chips are hard to find and pricey if you can. Now I need to start all over again.
Thanks for the links to the extra timer stuff. I tried a few of the init timer stuff and now my Timer0 is actually running. I will try to understand those tutorials above and see if I can get the 16-bit timer to work. I will be ordering the PicKit Plus shortly and try to donate more later in the year. Thanks for your efforts!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Guys, I've been using a PIC16F684 for some years in my model plane projects. Now that I can't get any more......easily, I was told by Microchip that I should change to the 16F18324 as it is "basically" the same. Hmmm....it isn't! There are many differences that I just can't figure out. Just as an example I'm trying to use Timer 0 for something so I wrote this short test program which works on my 16F684:
'PIC 16F684 Timer tester by Keith Renecle May 2022
Forgive the huge "# config statements".
I would appreciate any help. Thanks.
Keith R
Last edit: Anobium 2023-07-26
Keith - they recommended a newer chip, As you have discovered.. the new chip is not the same it is truly different. It is the best upgrade but many things are different.
As you did not post reference program for the 16F684 ... I am now in guessing mode,
So, update to latest toolchain.
Also, look at the Demos for this chip range.
C:\GCstudio\gcbasic\demos\vendor_boards\great_cow_basic_demo_board\16f18326_chiprange_demonstrations
The the 18326 is the same chip with different memory but these demos will give you many insights.
I would recommend you work through the demos porting to your new chip. It will cover PPS, I2C, SPI and the Timers.
The Timers are 8/16 bit - they have different setup etc The demos show Timer0 and other timers.
Also, look at the Demos for this chip range.
C:\GCstudio\gcbasic\demos\vendor_boards\great_cow_basic_demo_board\16f18326_chiprange_demonstrations
The the 18326 is the same chip with different memory but these demos will give you many insights.
I would recommend you work through the demos porting to your new chip. It will cover PPS, I2C, SPI and the Timers.
The Timers are 8/16 bit - they have different setup etc The demos show Timer0 and other timers.
Hi Anobium, thanks for the reply. I was running the 16F684 at 20MHz with an external crystal and the 2 caps on my pc board. I get 00 in RAM memory 0. It looks to me as if the timer is not running on the 16F18324. If I add a line "TMR0 = 100" for example, then it will stick 64 Hex in the memory. If I do this on the 20 MHz 684, then it shows 100 + 255 because it jumps over the 255 in that 20 ms timing. However on the 18324 nothing changes. It's as if the timer has not been initiated.
I downloaded the latest GC Studio two days ago because I was indeed using the 2021 version of Synwrite compilor, but it does exactly the same. In my old version of Synwrite, there are many demos, but in my latest GC Studio download, I only find 3 small files. Maybe I don't have the correct GC Studio download?
Good news on the tool chain.
Demos are in the files tool https://sourceforge.net/projects/gcbasic/files/GCStudio%20-%20Complete%20IDE%20and%20Toolchain%20for%20Windows/GCBdemonstrationsPack.exe/download
The timer init is different, so, I probably was not setup. Get the demos for the chip show how to setup.
Thanks again. Hmmm.........I'm getting too old (73) for these changes! Those demos just confuse me even more unfortunately. What happened to the configs from the old GCB programs?? I looked at a few of those demos using the 18326 chip, but they just don't make much sense to me and are mainly using the PWM stuff and not Timer 0.
Just btw, my 18324 program works fine on Timer 1, 2 etc. It's just Timer 0 that's catching me out. I'm running W7 on my desktop because it just works the way I like it. I have a fairly good laptop with W10, so I downloaded GC Studio just now from Sourceforge. It also doesn't work on my timer 0 program.
This is all for my control line model plane governor timer gadget that you guys have helped me with for quite a few years. I thought that it would be easy to just change the chip and re-do the differences in timing from 20 MHz to 16. Hmmm.....that was wishful thinking! I have a Run section and a Programming section in my software, and now pressing my Program button does not even jump to that section. It jumps back to the beginning of my program and it is just a simple GOTO statement. I obviously have a bum program that was tolerated by the old chip and compiler.
Quick question. I see that Synwrite sticks green lines after various sections of my program. What do they mean?
Oh.....one more admission. I have the old PicKit 2 which no longer worked with these modern chips, so I found the PicKitminus driver software. I looked at the PicKitPlus software but there were costs involved. I'm a pensioner living in Darkest Africa (South Africa) where our wonderful currency is worth peanuts. Not quite as bad as the Zimbabwe $, but getting there every day!
I did consider that it's the PicKitminus software that's the issue, but it works ok with my old programs and also the 18324 test programs besides the timer 0 program, so I don't think that this is my problem.
That makes 2 of us Keith.
I am not sure I have any 16F18324 devices, I havn't bother to get any samples for the past few years so am a bit out of touch, but I did create the Millis Library which uses Timer 0 and we tested it extensively across the supported devices. I don't recall if we tested the 16F18324 specifically though.
Where are you based?
I am in Cape Town.
Cheers
Chris
Hi Chris, I stay in Centurion near Pretoria. Please drop me an email at krenecle<at sign="">netactive.co.za and we can chat some more. Thanks!</at>
I tried various things now, and I'm fairly convinced (?) that I'm simply not initializing Timer 0. My statement "InitTimer0 Osc, PS0_1/256" does not seem to work with the 18324. Is there some new way of doing this on this chip for Timer 0? Maybe because it is a 8 or 16 bit timer, I need to select this somehow, but I can't figure it out from the data sheet.
Here is my similar program for Timer 2 testing and like I say, it works just fine.
'PIC 16F684 Timer 2 tester by Keith Renecle May 2022
chip 16F18324, 16
config Osc = Int
define LED PORTC.3
Dir LED Out
InitTimer2 Osc, PS2_1/4
Start:
ClearTimer 2
StartTimer 2
Wait 22 ms 'time this value
StopTimer 2
EPWrite(0, TMR2)
wait 20 ms
PulseOut LED, 250 ms
end
Last edit: Keith Renecle 2023-07-26
I know you are not setting up the timer correctly. Look at demo 18. It shows how to setup the Timer0,
Re PICKitMinus. It is total plagiarism of my works. He has taken my works and claimed as his. He has not attributed my work. I spent years getting PICKitPlus quality correct to have that happen.
The money required to obtain PICKItPlus gives you support. Support that is better than Microchips. PICKItPlus is an aproved Software Partnet of Microchip.
I am a pensioner also.
Yes, I am not happy about PICKitMinus.
Humble apologies, I did not know that you were the guy that does the PicKitPlus software. I mean no disrespect and always appreciate the help from this forum. However, I do get ticked off when companies like Microchip make their products obsolete. I have two PicKit2 programmers that are useless without this extra driver software, and my small project is basically all I use PIC's for. I have a bunch of pc boards with the new 18324 on them with smd parts, so I'm not working with a plug-in chip to play with. The board has inputs and outputs, one being an LED and this allows me to try with small programs to see what's going on. My previous board was designed for the PIC16F684-I/ST which is the tiny 14 pin TSSOP version. Now that I can no longer buy these chips easily, or cheaply, I ordered boards with the 18324 chips on them.
My main problem is that I just cannot figure out why I can't use the same terminology and configs for the 18324. You send me links to demos but they don't explain these details properly and my project is not the same. I look at the documentation on GC Studio, under timers and the syntax for initializing Timer0 is "InitTimer0 source, prescaler". Then in the sample program it says the following:
'Set up the timer using the internal oscillator with a prescaler of 1/2 (Equates to 0)
'Timer 0 starts automatically on a Microchip PIC microcontroller, therefore, StartTimer is not required.
InitTimer0 Osc, PS0_2
Hmmm, in the #18 demo, they use StartTimer 0!
Now that's all fine and dandy, but it no longer works like this, so what has changed? Here is the line in that demo#18 that you suggest:
InitTimer0 Osc, PRE0_16384 + TMR0_HFINTOSC, POST0_11
So now the "InitTimer0 Osc" is fine, but what does "PRE0_16384 + TMR0_HFINTOSC" mean? It seems that PRE0 is now for the prescaler, but why 16384 + TMR0_HFINTOSC? I understand that POST0_11 must be a post-scaler setting.
Hopefully you're not too pissed off with me to help me some more? If there is a more recent tutorial on using these timers on the new chips with GCB, then maybe you could point me to that. I also need to know what the green line that pops up in Synwrite shows. Thanks very much.
Do not be humble - please. Understand.
I am the same person. I used the funds from PICKITPlus to help support GCBASIC.
Cost for GCBASIC will be approx £600 GBP. I will be looking for donations in November.
PICKITPlus and GCBASIC are not free to provide the costs are rising and rising.
GCBASIC - this is Open Source but someone has to pay the bills and I expecti donations to cover the costs, to the greatest extent.
PICKITPLUS - this is a huge development program and the licenses pay the cost of the developer, hosting and services. Any think left over goes into the GCBASIC fund.
Why the difference ? GCBASIC is always going to free to obtain and with a donation model. PICKITPLUS is used by many more comnpilers for many different uses and therefore a license model is applicable.
Having someone take the PICKITPLUS database and plagerise the work upsets the overall model. I tried to give him all the source and agree a model going forward but he just broke things.
PICKITMINUS - it can and it will get out of support. He used the 223 version of the database. We are now on 237 with many new chips and 100s of fixes. If he takes this database then I will take legal action against him.
The PICKit2 or the PICKit3 is not obsolete. Microchip does not provide technival support for them. Microchip supports PK2 and PK3 etc in the MPLAB-X Development tools. The CEO made a clear statement of legacy support in March 2022.
PICKit2 / PICKit3 support is provide by PICKITPLUS, as a Microchip Support Partner. Having a license for PICKITPLUS enables the support.
The assumption the 18324 was a similar chip may have been an over simplication. The DEMOS show the differences. It would simple to create the same demos for the 684 to show these differences - they include PMW Setup, Serial Setup, Timer Setup etc and the register names are different acrosss many functional areas.
They are different chips hence the different terminology.
Then, take the link to https://gcbasic.sourceforge.io/help/_inittimer0_8bit_16bit.html
I have been involved with GCBASIC for a long time. This is not water of ducks back but I hope the few pounds that you will provide to support GCBASIC or to buy a license for PICKITPLUS are the only way these projects will remain operation.
Cus, when I stop do this. Both projects may suffer.
There are a many YouTube videos on my channel. Specificially, the 18326 ( a sister chip ) and therefore the tuturials are very applicable to your use case.
Evan
Thanks again Evan, I now fully understand your explanation of all of this. I'm a casual user and a lousy programmer to boot, so I only use PIC chips or any programming occasionally. I'm a retired electronics technician by trade, but that was with analogue stuff. I was quite happy with my project and the old 16F684 and would have carried on making my gadget here and there as it was for a while longer but since 2020 the world changed and now the old chips are hard to find and pricey if you can. Now I need to start all over again.
Thanks for the links to the extra timer stuff. I tried a few of the init timer stuff and now my Timer0 is actually running. I will try to understand those tutorials above and see if I can get the 16-bit timer to work. I will be ordering the PicKit Plus shortly and try to donate more later in the year. Thanks for your efforts!