Hi Guys,
I have just upgraded to CCS C 4.120 to enable programming of the PIC18F26K22, I have created a quick test program to run the UART using the wizard, and I cant seem to get it to simulate properly in Proteus, it says logic contention on net in the warnings in Proteus.
I want to test this before putting it onto the chip, and I have had this issue before and it's because the pins are multiplexed, i'm thinking i've missed something.
Anyways.
Test code (mian.c)
test code (main.h)
I also created another project and turned things off specifically, and it still does the same.
(main.h)
and the C file (main.c)
I have tried setting TRIS but doesn't make a difference!
I used to really like CCS C, and only upgraded from 4.105 for the newer chips, but it seems that the newer chips are having issues with the compiler, which is a shame! I compiled some code for another PIC chip, cant remember the exact variant now, but I used C18 and it worked perfectly, tried to compile the same thing in CCS C and I have a similar issue! Still never resolved it.
Any help appreciated!
Wilksey
I have just upgraded to CCS C 4.120 to enable programming of the PIC18F26K22, I have created a quick test program to run the UART using the wizard, and I cant seem to get it to simulate properly in Proteus, it says logic contention on net in the warnings in Proteus.
I want to test this before putting it onto the chip, and I have had this issue before and it's because the pins are multiplexed, i'm thinking i've missed something.
Anyways.
Test code (mian.c)
Code:
#include <main.h>
void main()
{
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
setup_oscillator(OSC_4MHZ|OSC_INTRC|OSC_31250|OSC_PLL_OFF);
while(1)
{
}
}
test code (main.h)
Code:
#include <18F26K22.h>
#device adc=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPLLEN //4X HW PLL disabled, 4X PLL enabled in software
#FUSES NOFCMEN //Fail-safe clock monitor disabled
#FUSES NOIESO //Internal External Switch Over mode disabled
#FUSES NOBROWNOUT //No brownout reset
#FUSES WDT_SW //No Watch Dog Timer, enabled in Software
#FUSES NOPBADEN //PORTB pins are configured as digital I/O on RESET
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES NOSTVREN //Stack full/underflow will not cause reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#use delay(int=4000000)
#use rs232(baud=38400,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,stream=PORT1)
I also created another project and turned things off specifically, and it still does the same.
(main.h)
Code:
#include <18F26K22.h>
#device adc=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES NOPLLEN //PLL Enable
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOBROWNOUT //No brownout reset
#FUSES WDT_NOSLEEP //Watch Dog Timer, disabled during SLEEP
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#fuses NODEBUG
#use delay(int=4000000)
//#use delay(int=64000000)
#use rs232(baud=38400,parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8,stream=ILIGHT_PC)
#use rs232(baud=38400,parity=N, xmit=PIN_B6, rcv=PIN_B7, bits=8,stream=ILIGHT_TFU)
and the C file (main.c)
Code:
#include <main.h>
void main()
{
setup_timer_0(T0_OFF);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_timer_4(T4_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_ccp1(CCP_OFF);
setup_ccp2(CCP_OFF);
setup_ccp3(CCP_OFF);
setup_ccp4(CCP_OFF);
setup_ccp5(CCP_OFF);
setup_dac(DAC_OFF);
setup_adc(ADC_OFF | NO_ANALOGS);
setup_oscillator(OSC_4MHZ|OSC_INTRC|OSC_PLL_OFF);
while(1)
{
}
}
I have tried setting TRIS but doesn't make a difference!
I used to really like CCS C, and only upgraded from 4.105 for the newer chips, but it seems that the newer chips are having issues with the compiler, which is a shame! I compiled some code for another PIC chip, cant remember the exact variant now, but I used C18 and it worked perfectly, tried to compile the same thing in CCS C and I have a similar issue! Still never resolved it.
Any help appreciated!
Wilksey