I'm trying to use a program that runs fine on a 16F690, on a 12F1501.
I am using RA0 and RA1 as ADC inputs with this simple line:
if ReadAD(AN0) < ReadAD(AN1) then ...
When compiling in MPLAB for 12F1501 it complains:
"Symbol not previously defined (ADCS1)" and "Symbol not previously defined (ADCS0)"
The only instances of ADSCx in the asm file (that GCB generated) is this:
banksel ADCON1
bcf ADCON1,ADCS1
bsf ADCON1,ADCS0
-Is it me (doing something the PIC is not capable of) or is GCB doing something wrong?
====
;Chip Settings
#chip 12F1501,0,125
#config OSC=INTOSC
dir PORTA.0 in
dir PORTA.1 in
DIR PORTA.2 out
DIR PORTA.3 out
'Main code
set PORTA.2 off
set PORTA.3 off
stopdo=0
Do Forever
if stopdo=4 then
exit do
end if
stopdo= stopdo + 1
set PORTA.2 on
wait 1 s
if ReadAD(AN0) < ReadAD(AN1) then
opendo = 1
else
opendo = 0
end if
if opendo = 1 then
For i = 0 to 100
set PORTA.3 on
wait 1 ms
set PORTA.3 off
wait 9 ms
next
end if
if opendo = 0 then
For i = 0 to 100
set PORTA.3 on
wait 2 ms
set PORTA.3 off
wait 8 ms
next
end if
set PORTA.2 off
wait 2 s
loop
'close lid and quit forever
set PORTA.2 on
wait 1 s
For i = 0 to 100
set PORTA.3 on
wait 2 ms
set PORTA.3 off
wait 8 ms
next
set PORTA.2 off
end
Last edit: Roger Jönsson 2017-05-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looks like a malformed chipdata file for the 12f1501. Goto gcbasic/chipdat/12f1501.dat and add the clock select bits (copy and paste) then save the file.
The "#" was lost when pasting the code to the forum. I now fixed that post.
After editing the DAT file with GCB Version 1.0 2015-07-12, it throws up (opening Hardware settings):
"The chip model currently selected for this program is not valid, please check that the model of chip is correct" then "Great Cow Graphic BASIC could not find any config settings for this chip" when trying to select 12F1501.
Replacing with the original 12f1501.dat it works as before.
Some checksum error or what?
Is there some special trick needed to edit the .dat files (I tried several editors)?
The last version of the .dat file is attached.
I downloaded the complete Great Cow Basic IDE yesterday, in which I found Version 1.0 2015-07-12 and that is what I tried to use. If I just open 1.0 2015-07-12 and try to select the 12f1501, it says it does not exist after I have edited the .dat (which works with the old 0.9.14). 1.0 2015-07-12 finds the unedited .dat fine.
When I went back to my old GCB 0.9.14 it works (writing the code in the old Crimson Editor and then doing "Compile and Download with GCBasic" and using the edited .dat.
EDIT: Again I was wrong. The old 0.9.14 used the .dat file that came with it.
Last edit: Roger Jönsson 2017-05-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As said, I can not even open the edited 12f1501.dat in the new GCB.
I now tried with the older 12f1501.dat (2013-03-25) from the old GCB and now when I compile with the latest CGB the build seems fine in MPLAB, but the programmed PIC doesn't do anything, so that workaround did not work...
Your program didn't work until I changed the 0.125 tp 0,125 (point to a comma). I do not know why this is. Maybe something about the language of the OS (XP), but weird it is.
Then it passed MPLAB without build errors.
#chip 12F1501,0.125
changed to:
#chip 12F1501,0,125
With the original 12f1501.dat that came with the latest GCB it complies in this latest GCB, but when I try to build it in MPLAB v8.92 the build fails:
"Symbol not previously defined (ADCS1)" and "Symbol not previously defined (ADCS0)"
Since the edited 12f1501.dat (suggested in this thread) is not accepted by this latest GCB, I am out of ideas to try.
I was wroing about the GCB 0.9.14. It always used the original .dat file that came with it.
Last edit: Roger Jönsson 2017-05-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The root cause of the issue is that the MPLAB include file is missing a set of bit/registers. We know they are missing so we correct in our dat files - however, when you try to use with MPASM the corrections will not work - hence the error.
If you still want to use MPASM add the following to your user code and all should work fine.
It looks like I should have a look at generating HEX-files and where to put them and what to use to get the code into the PIC. It is so long since I fiddled with HEX-files and serial programmer, that I have no idea where to start. -Well to be honest I havenät really looked yet :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Big fan of the Pickit 2, mostly because of GUI it comes with, and the improved device file that William here made up. Device file can found in GCB, and it will handle the 12f1501 and many other newer devices. Clones can be had for cheap, and with a dupount cable, or right angle header, can plug right into a breadboard for in circuit programming (that is 90% of my use).
Another option is a Pickit 3 along with the MPLAB IPE.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have both. Pic Kit 2 is great as it works fine without MPLAB, but how does one make it support 12f1501? 12f1501 was the reason I bought Pickit 3 !... but then I had to use MPLAB, which has worked fine for many years until the A/D converter problems turned up.
I looked at getting Pickit 3 working directly with GCB a year or so ago, but I couldn't figure out how to make it work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm trying to use a program that runs fine on a 16F690, on a 12F1501.
I am using RA0 and RA1 as ADC inputs with this simple line:
if ReadAD(AN0) < ReadAD(AN1) then ...
When compiling in MPLAB for 12F1501 it complains:
"Symbol not previously defined (ADCS1)" and "Symbol not previously defined (ADCS0)"
The only instances of ADSCx in the asm file (that GCB generated) is this:
banksel ADCON1
bcf ADCON1,ADCS1
bsf ADCON1,ADCS0
-Is it me (doing something the PIC is not capable of) or is GCB doing something wrong?
====
Last edit: Roger Jönsson 2017-05-19
Looks like a malformed chipdata file for the 12f1501. Goto gcbasic/chipdat/12f1501.dat and add the clock select bits (copy and paste) then save the file.
Chipdata file [bits]
Should be:
Also the number sign (#) is required when dealing with chip and config lines, like so:
So now the program should compile.
The "#" was lost when pasting the code to the forum. I now fixed that post.
After editing the DAT file with GCB Version 1.0 2015-07-12, it throws up (opening Hardware settings):
"The chip model currently selected for this program is not valid, please check that the model of chip is correct" then "Great Cow Graphic BASIC could not find any config settings for this chip" when trying to select 12F1501.
Replacing with the original 12f1501.dat it works as before.
Some checksum error or what?
Is there some special trick needed to edit the .dat files (I tried several editors)?
The last version of the .dat file is attached.
Last edit: Roger Jönsson 2017-05-19
With GCB 0.9.14 the edited .dat file is accepted. Why is 1.0 not accepting the edited 12f1501.dat?
(RA3 would not output, but now I see that it is not a general output...)
Edit (later): I was wrong!!! GCB 0.9.14 still used the .dat file that came with it. AND IT WORKS without editing!
Last edit: Roger Jönsson 2017-05-19
May I check? What version of the Great Cow BASIC compiler release are you using?
And, you are using Great Cow Graphical BASIC Version 1.0 2015-07-12?
I downloaded the complete Great Cow Basic IDE yesterday, in which I found Version 1.0 2015-07-12 and that is what I tried to use. If I just open 1.0 2015-07-12 and try to select the 12f1501, it says it does not exist after I have edited the .dat (which works with the old 0.9.14). 1.0 2015-07-12 finds the unedited .dat fine.
When I went back to my old GCB 0.9.14 it works (writing the code in the old Crimson Editor and then doing "Compile and Download with GCBasic" and using the edited .dat.
EDIT: Again I was wrong. The old 0.9.14 used the .dat file that came with it.
Last edit: Roger Jönsson 2017-05-19
Can you please try your code in the latest build with NO editing to any of the .dat files.
Your code works here - so, I am puzzled.
To clarify I used the GCB_Installer-97.exe 2017-03-05 to install yesterday.
Is there an unofficial newer build? If so where do I find it?
If you used the GCB_Installer-97.exe 2017-03-05 to installed yesterday - can you confirm the results?
I get a good build. Do you? I have attached my program.
As said, I can not even open the edited 12f1501.dat in the new GCB.
I now tried with the older 12f1501.dat (2013-03-25) from the old GCB and now when I compile with the latest CGB the build seems fine in MPLAB, but the programmed PIC doesn't do anything, so that workaround did not work...
Your program didn't work until I changed the 0.125 tp 0,125 (point to a comma). I do not know why this is. Maybe something about the language of the OS (XP), but weird it is.
Then it passed MPLAB without build errors.
With the original 12f1501.dat that came with the latest GCB it complies in this latest GCB, but when I try to build it in MPLAB v8.92 the build fails:
"Symbol not previously defined (ADCS1)" and "Symbol not previously defined (ADCS0)"
Since the edited 12f1501.dat (suggested in this thread) is not accepted by this latest GCB, I am out of ideas to try.
I was wroing about the GCB 0.9.14. It always used the original .dat file that came with it.
Last edit: Roger Jönsson 2017-05-19
OK. Why not try using the in-built compiler and assembler within Great Cow BASIC? Does this work?
I do get the same two errors in MPASM - so, please use the assembler within Great Cow BASIC - the generated HEX should be the same.
The root cause of the issue is that the MPLAB include file is missing a set of bit/registers. We know they are missing so we correct in our dat files - however, when you try to use with MPASM the corrections will not work - hence the error.
If you still want to use MPASM add the following to your user code and all should work fine.
Ok. Thanks for the help.
It looks like I should have a look at generating HEX-files and where to put them and what to use to get the code into the PIC. It is so long since I fiddled with HEX-files and serial programmer, that I have no idea where to start. -Well to be honest I havenät really looked yet :)
Big fan of the Pickit 2, mostly because of GUI it comes with, and the improved device file that William here made up. Device file can found in GCB, and it will handle the 12f1501 and many other newer devices. Clones can be had for cheap, and with a dupount cable, or right angle header, can plug right into a breadboard for in circuit programming (that is 90% of my use).
Another option is a Pickit 3 along with the MPLAB IPE.
I have both. Pic Kit 2 is great as it works fine without MPLAB, but how does one make it support 12f1501? 12f1501 was the reason I bought Pickit 3 !... but then I had to use MPLAB, which has worked fine for many years until the A/D converter problems turned up.
I looked at getting Pickit 3 working directly with GCB a year or so ago, but I couldn't figure out how to make it work.
Here is a link to the PicKit 2 device.dat file, https://sourceforge.net/p/gcbasic/discussion/629990/thread/7c0f5a1a/#7682 just drop it in your PK2 folder. I don't have the location of this file in the IDE, but there have been a couple of threads on this.
Thanks. I will have a look at it later.