|
|
View previous topic :: View next topic |
Author |
Message |
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
18F46K80-NEW COMPILER Ver 4.121- [SOLVED] FIXED |
Posted: Tue Mar 29, 2011 1:50 pm |
|
|
Hi,
There are new changes with this chip?? TGM MAY 7, 2011 see post at end
This compiler change for the K80 chip setup in Ver 4.121 is good now!!!
#include <18F46K80.h>
#device ADC=16
#device HIGH_INTS=true
#fuses NOWDT,NOPROTECT,NOBROWNOUT,PUT,NOMCLR,HSH,PLLEN // 4x PLL enable
#use delay(clock=64M, crystal=16M) // 4x PLL enable
#define VSS 0xFF //Analog Negative Channel connected to Vss
//This (NOMCLR) and programming of EEPROM is FIXED in the NEW CCSLOAD Progammer software
GO TO CCS site and load the new software for ICD-U64.....
At this time the ICD-U40 may not work with the new ccsload software so be aware that problem and U40 device.
//can program fuse "NOMCLR" so Pin 1 is now RE3 "INPUT ONLY", no master reset
---------------
Thanks Nick, --------- for your great work on this fix -----------
---------------
Thank You,
Tom W2DRZ
Last edited by w2drz on Sun May 08, 2011 1:13 am; edited 24 times in total |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Tue Mar 29, 2011 4:10 pm |
|
|
FWIW, I am using the 18F45Kxx and 18F46Kxx chips with no problems on PCWH 4.114. _________________ Google and Forum Search are some of your best tools!!!! |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
Compiler version for the 18F46K80 chip |
Posted: Tue Mar 29, 2011 6:08 pm |
|
|
Thanks, have just ordered the renewal shows to be 4.119 now.
W2DRZ tom |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
18F46K80 |
Posted: Sat Apr 02, 2011 8:58 pm |
|
|
FIXED IN NEW COMPILER.
4.121 is new for the 18F46K80 and
ALSO FIXED--have conversed with CCS about use of FUSE "NOMCLR", U-64 & ccsload software problem
Thank You
TG Mott W2DRZ
Have not update to the following code so on your own about using it..
Code: |
/***********************************************
Change for 18F46K80, A4 pin is now a 3.3 volt internal reg. need 10 UF cap. added to pin
// compiler 4.121 FIXED problem with FUSE "NOMCLR"
**********************************************/
#include <18F46K80.h>
#device ADC=16
#device HIGH_INTS=true
#fuses NOWDT,NOPROTECT,NOBROWNOUT,PUT,NOMCLR,HSH,PLLEN // high speed crystal & 4x PLL enable
#use delay(clock=64M, crystal=16M) // enable 4xPLL
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, stream=DRZ_COM,errors)
#use rs232(baud=9600, xmit=PIN_C4, rcv=PIN_E3, enable=PIN_B7, stream=ABS_COM, disable_ints)
#define VSS 0xFF //Analog Negative Channel connected to Vss
#define INTS2_PER_SECOND 10
#priority INT_RB, int_ad, int_rda
// also see #INT_RTCC HIGH
#include <float.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <lcd.c>
typedef short bool;
byte T0Counter; // Number of interrupts left before a second has elapsed
void RunME ();
float gAzimuth;
int SecondsTimer,RebootTimer,NEW_ANALOG,LO_ANALOG;
void T0_isr ();
short bLcdAttached,gbAdcEnable;
long val;
void SIGNAL_LEVEL ();
void main ()
{
setup_ccp1 (CCP_OFF);
setup_ccp2 (CCP_OFF);
setup_timer_0 (RTCC_INTERNAL | RTCC_DIV_32); // setup timer 0 interrupts
set_timer0 (15518); // overflows in about (100 ms)
T0Counter = INTS2_PER_SECOND;
setup_adc_ports (sAN0|sAN1|sAN3|VSS_VDD); // changed for 18F46K80
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_16);
set_adc_channel(0);
lcd_init ();
bLcdAttached = TRUE;
enable_interrupts (int_rda);
enable_interrupts (INT_TIMER0);
enable_interrupts (int_ad);
enable_interrupts (global); // start all interrupts
RunME ();
}
void RunME ()
{
do{
if (bLcdAttached){ // see timer reset 1 second
SIGNAL_LEVEL ();
}
if (gbAdcEnable){ // see timer reset .1 second
read_adc (ADC_START_ONLY); // Channel 0 AtoD
gbAdcEnable = false;
RebootTimer = 2;
printf (lcd_putc, "\f El:%3.2f", gAzimuth);
}
}
while (true);
}
void SIGNAL_LEVEL ()
{
NEW_ANALOG = val / 256;
LO_ANALOG = val % 256;
bLcdAttached = FALSE; // timer must reset this to true
}
#int_ad // ADC interrupt service routine
void adc_isr ()
{
val = gAzimuth = read_adc (ADC_READ_ONLY); // read the ADC result
}
#int_rda
void rs232_handler ()
{
int ch;
bool bError = false;
if (rs232_errors & 6) // Test framing and overflow error bits
bError = true;
if (! kbhit ())
return; // nothing there, false interrupt
ch = getc (); // get input character
if (bError)
return; // ignore character
switch (ch) {
case 0x95: // Signal Level
fputc (NEW_ANALOG, DRZ_COM);
break;
case 0x96: // CLOCK
fputc (LO_ANALOG, DRZ_COM);
break;
}
fputc (ch, DRZ_COM); // ack back, for any input recieved
}
#INT_RTCC HIGH
void T0_isr ()
{
set_timer0 (15518);
if (--T0Counter == 0) {
T0Counter = INTS2_PER_SECOND; // reset counter for 1 second loop
if (SecondsTimer) // 1 second timer
--SecondsTimer;
bLcdAttached = TRUE;
}
if (RebootTimer){ // .1 second timer for reboot message timing
--RebootTimer;
gbAdcEnable = true;
}
// This is about .1 sec for more stuff
}
|
Last edited by w2drz on Tue May 03, 2011 1:26 am; edited 21 times in total |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
18F46K80 |
Posted: Tue Apr 05, 2011 4:56 pm |
|
|
Hi,
See post at end
TGM
Last edited by w2drz on Wed Apr 27, 2011 5:56 pm; edited 1 time in total |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
Re: 18F46K80 for 4xPLL #use delay(clock=64M) |
Posted: Wed Apr 13, 2011 4:56 pm |
|
|
w2drz wrote: | Hi,
18F46K80 here is a change #use delay(clock=64M, crystal=16M)
TGM |
Code: |
#include <18F46K80.h>
#device ADC=16
#device HIGH_INTS=true
#fuses NOWDT,NOPROTECT,NOBROWNOUT,PUT,MCLR,HSH,PLLEN // 4x PLL enable
//NOMCLR is FIXED IN Ver. 4.121 and new ccsload 4/29/2011 tgm
//NOMCLR = Pin 1 is now RE3 input only, no master reset
#use delay(clock=64M)
#define VSS 0xFF //Analog Negative Channel connected to Vss |
thats it for now
W2DRZ tgm
Last edited by w2drz on Mon May 02, 2011 10:45 pm; edited 3 times in total |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
Re: 18F46K80 update 4-27-11 -- FIXED IN Ver. 4,121 & ccs |
Posted: Wed Apr 27, 2011 5:51 pm |
|
|
w2drz wrote: | w2drz wrote: | Hi,
18F46K80 here is a change #use delay(clock=64M, crystal=16M)
TGM |
[code]
#include <18F46K80.h>
#device ADC=16
#device HIGH_INTS=true
#fuses NOWDT,NOPROTECT,NOBROWNOUT,PUT,MCLR,HSH,PLLEN // 4x PLL enable
//FUSE NOMCLR Pin 1 is now RE3 input only, no master reset
#use delay(clock=64M)
#define VSS 0xFF //Analog Negative Channel connected to Vss
#define INTS2_PER_SECOND 10 // adjust for .1 sec to 1 sec
void main ()
{
setup_ccp1 (CCP_OFF);
setup_ccp2 (CCP_OFF);
setup_timer_0 (RTCC_INTERNAL | RTCC_DIV_32); // setup timer 0 interrupts
set_timer0 (15518); // overflows in (100 ms)
T0Counter = INTS2_PER_SECOND; // count to a (10) for close to 1 second
setup_adc_ports (sAN0|sAN1|sAN3|VSS_VDD); // for 18F46K80
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_16); //
enable_interrupts (int_rda);
enable_interrupts (INT_TIMER0);
enable_interrupts (int_ad);
enable_interrupts (global); // start all interrupts
//MORE STUFF HERE
}
#INT_RTCC HIGH
void T0_isr ()
{
set_timer0 (15518); //overflows in (100 ms)
if (--T0Counter == 0) { //1 sec
T0Counter = INTS2_PER_SECOND; // reset counter for 1 second loop
if (SecondsTimer) // 1 second timer
--SecondsTimer;
}
// This is about .1 sec for more stuff
display2 = true; // update stuff flag
}
W2DRZ tgm |
FIXED IN Ver. 4.121 & new ccsload 4/10/11
W2DRZ
Last edited by w2drz on Tue May 03, 2011 1:28 am; edited 6 times in total |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
18F46K80 ---NEW COMPILER Ver 4.121--- [SOLVED] |
Posted: Sun May 01, 2011 9:25 pm |
|
|
Hi,
After have a problem with the interrupts not working that had mux settings with interrupts and with ANALOG use on the same pin,
4 days of working on fix.......
I found a 'DUMB' programming setting on my part...........
This will not do a error or warning so just be aware not to do the same.
This is GOOD:
setup_adc_ports (sAN0|sAN1|sAN3|VSS_VDD); // ect of ad pins
THIS IS BAD--------------------
setup_adc_ports (sAN0-sAN1-sAN3,VSS_VDD);
This will enable a override of 'MUXED' pins to BE --ANALOG and
NO interrups on these 'MUXED' pins will work correctly-----
Now all seems to work just fine with the 18F46K80 chip including "FUSE NOMCLR"
Tom W2DRZ
Last edited by w2drz on Tue May 03, 2011 1:41 pm; edited 2 times in total |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun May 01, 2011 11:27 pm |
|
|
Quote: | THIS IS BAD--------------------
setup_adc_ports (sAN0-sAN1-sAN3,VSS_VDD); |
Obviously. Where did you get the idea to combine sANx constants with a minus operator? |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
18F46K80 MUX PROBLEMS with RC0 & RC1 pins |
Posted: Sat May 07, 2011 2:51 pm |
|
|
Hi Here is the latest.
Have issues with RC0 and RC1 not switched to being I/O ports,
Need a fix any help?
This is in the spec sheets but do not find a command in the compiler to deal with the 'SOSCSEL bits' must be set to Digital mode.
SEE pg 58:
3.3 Clock Sources and
Oscillator Switching
If a secondary oscillator is not desired and digital I/O on
port pins, RC0 and RC1, is needed, the SOSCSEL bits
must be set to Digital mode.
Also have ISSUES with the setting of:
#define VSS 0xFF //Analog Negative Channel connected to Vss
The Analog change to using the
PIC18FXX80 to PIC18FXXK80 Migration Guide
12-BIT ANALOG-TO-DIGITAL
CONVERTER (A/D)
while PIC18FXXK80 devices have a 12-bits with a sign
bit A/D Converter.
The converter in PIC18FXXK80 devices is a differential
A/D Converter (with two inputs), while PIC18FXX80
devices have a single input. The PIC18FXXK80
devices differential A/D Converter can be configured as
a single input A/D Converter by connecting the negative
input internally to AVSS
This command has a differance voltage from ANALOG VDVSS ground and core VSS ground of 2 millivolts to 4 millivolts.
Any comments on a fix to the analog problem and the compiler command for RC0 & RC1 I/O setting.
Thank You,
Tom W2DRZ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 07, 2011 6:56 pm |
|
|
Quote: | Hi Here is the latest.
Have issues with RC0 and RC1 not switched to being I/O ports,
Need a fix any help?
Any comments on a fix to the analog problem and the compiler command for RC0 & RC1 I/O setting.
|
Post an extremely short test program that demonstrates these problems
and that I can "copy and paste" into MPLAB, and compile, to see these
problems. The program needs to have the #include for the PIC, #fuses,
#use delay, main(), and be extremely short. I assume you are using
vs. 4.121 for these tests. If not, let me know. |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
|
Posted: Sat May 07, 2011 11:56 pm |
|
|
PCM programmer wrote: | Quote: | Hi Here is the latest.
Have issues with RC0 and RC1 not switched to being I/O ports,
Need a fix any help?
Any comments on a fix to the analog problem and the compiler command for RC0 & RC1 I/O setting.
|
Post an extremely short test program that demonstrates these problems
and that I can "copy and paste" into MPLAB, and compile, to see these
problems. The program needs to have the #include for the PIC, #fuses,
#use delay, main(), and be extremely short. I assume you are using
vs. 4.121 for these tests. If not, let me know. |
Code: |
// compiler ver. 4.121 ICD-U64 with ccsload 28 software installed
#include <18F46K80.h>
#device HIGH_INTS=true
#fuses NOWDT,NOPROTECT,NOBROWNOUT,PUT,MCLR,HSH,PLLEN // 4x PLL enable
#use delay(clock=64M, crystal=16M) // 4x PLL enable
#USE STANDARD_IO(C)
#define VSS 0xFF //Analog Negative Channel connected to Vss
#define INTS2_PER_SECOND 10 // changed for 64 MHz clock 18F36K80 chip
byte T0Counter; // Number of interrupts left before a second has elapsed
void RunME ();
int SecondsTimer,RebootTimer;
void main ()
{
setup_ccp1 (CCP_OFF);
setup_ccp2 (CCP_OFF);
setup_timer_0 (RTCC_INTERNAL | RTCC_DIV_32); // setup timer 0 interrupts
set_timer0 (15518); // overflows in (100 ms)
T0Counter = INTS2_PER_SECOND;// adjust this count to a (10) for close to 1 second
output_bit (PIN_D0,1);
output_bit (PIN_D1,1);
RebootTimer = 0;
SecondsTimer = 0;
enable_interrupts (INT_TIMER0);
enable_interrupts (global); // start all interrupts
RunME ();
}
void RunME ()
{
do{
input (PIN_C0);{
output_bit (PIN_D0,1); // pin high
SecondsTimer = 1; // set for 100 ms, .1sec
}
while (SecondsTimer); // wait
input (! PIN_C0);{ // pin low
output_bit (PIN_D0,0);
SecondsTimer = 1;
}
while (SecondsTimer); // wait
input (PIN_C1);{ // pin high
output_bit (PIN_D1,1);
SecondsTimer = 1;
}
while (SecondsTimer); // wait
input (! PIN_C1);{ // pin low
SecondsTimer = 1;
output_bit (PIN_D1,0);
}
while (SecondsTimer); // wait
}
while (true);
}
#INT_RTCC HIGH
void T0_isr ()
{
if (--T0Counter == 0) {
T0Counter = INTS2_PER_SECOND; // reset counter for 1 second loop
if (RebootTimer) // 1 second timer
--RebootTimer;
}
if (SecondsTimer) // .1 second timer
--SecondsTimer;
// This is about .1 sec for more stuff
}
/*
port pins, RC0 and RC1, is needed, the SOSCSEL bits
must be set to Digital mode.
*/
|
Here is a test pgm,
Thank You,
TGM W2DRZ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun May 08, 2011 12:42 am |
|
|
The 18F46K80.h file lists this fuse in it, and it works:
Regarding the analog problem, can you explain more about it ?
Make a small (only 1/5 of the code that you posted) that
shows what you are trying to do with the A/D converter.
Explain in what way it doesn't work. Explain how you know it
doesn't work. |
|
|
w2drz
Joined: 27 Dec 2006 Posts: 55 Location: Western New York - USA
|
|
Posted: Sun May 08, 2011 1:39 am |
|
|
PCM programmer wrote: | The 18F46K80.h file lists this fuse in it, and it works:
Regarding the analog problem, can you explain more about it ?
Make a small (only 1/5 of the code that you posted) that
shows what you are trying to do with the A/D converter.
Explain in what way it doesn't work. Explain how you know it
doesn't work. |
Hi,
These old eyes did not see the fuse after 3 days of looking at the problem never found that fuse, BIG AS ALL GET OUT, in the first line....
Code: |
// 05/08/2011 - SIMPLE TEST PROGRAM FOR NEW THINGS IN THIS -K80- CHIP
// compiler ver. 4.121 ICD-U64 with ccsload 28 software installed
#include <18F46K80.h>
#fuses NOWDT,NOPROTECT,NOBROWNOUT,PUT,MCLR,HSH,PLLEN,SOSC_DIG // 4x PLL enable
#use delay(clock=64M, crystal=16M) // 4x PLL enable
#USE STANDARD_IO(C)
#define VSS 0xFF //Analog Negative Channel connected to Vss
short new_val;
long val;
float gAzimuth;
void main ()
{
setup_adc_ports (sAN0|sAN1|sAN3|VSS_VDD); // for 18F46K80 04/12/2011
setup_adc(ADC_CLOCK_DIV_64|ADC_TAD_MUL_20); // 64 MHz & 16 bit conversion
set_adc_channel(0);
new_val = true;
enable_interrupts (int_ad);
enable_interrupts (global); // start all interrupts
RunME ();
}
void RunME ()
{
do{
if (new_val){
read_adc (ADC_START_ONLY); // Channel 0 Atod
new_val = false;
}
}
while (true);
}
#int_ad // ADC interrupt service routine
void adc_isr ()
{
val = gAzimuth = read_adc (ADC_READ_ONLY); // read the ADC result
new_val = true;
} |
The voltage for wiper ground output of the port will be negative value reading.
Not zero value as normal single ended analog core.
It is not any fix I find,
but then again I can not spell 'SOSC_DIG' or see it either??
That fuse FIXED the 'C0 and C1' I/O problem fine--------------
I can not find this setting in the .H file, do not know where I found this setting now??
#define VSS 0xFF //Analog Negative Channel connected to Vss
There is a value of +2 to +5 millivolts between ground and wiper of pot when the readout is near zero or as I recall to be 18 digital value for near zero, then reverts to reading up to about 15,000 at wiper zero voltage.
TGM W2DRZ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|