|
|
View previous topic :: View next topic |
Author |
Message |
sri.. Guest
|
undefined identifier in 18f97j60 |
Posted: Thu Sep 17, 2009 12:01 am |
|
|
Hi, I am working with simple relay/led ON program using pic18f97j60 controller. When I compiled it gives error as Undefined Identifier PortG,6. I am sending the code which I wrote.
Code: |
#include <18F97J60.h>
#device ICD=TRUE
#device adc=16
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES EC_IO //External clock
#FUSES DEBUG //Debug mode for use with ICD
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NOPROTECT //Code not protected from reading
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES PRIMARY //Primary clock is system clock when scs=00
#FUSES ECCPE //Enhanced CCP PWM outpts multiplexed with RE6 thorugh RE3
#FUSES ETHLED //Ethernet LED enabled
#FUSES WAIT //Wait selections for Table Reads and Table Writes
#FUSES BW16 //16-bit external bus mode
#FUSES MCU //Microcontroller Mode
#FUSES EASHFT //Address shifting enabled
#use delay(clock=25000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8,restart_wdt)
#define REL1 PORTG,6
#define REL2 PORTG,7
void main()
{
port_b_pullups(TRUE);
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_spi2(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
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_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
bit_set(REL1);
delay_ms(20000);
bit_set(REL2);
delay_ms(20000);
bit_clear(REL1);
delay_ms(20000);
bit_clear(REL2);
delay_ms(20000);
}
|
|
|
|
chimbu Guest
|
define address the problem will solved |
Posted: Thu Sep 17, 2009 12:20 am |
|
|
Code: |
#byte PORTA = 0xF80
#byte PORTB = 0xF81
#byte PORTC = 0xF82
#byte PORTD = 0xF83
#byte PORTE = 0xF84
#byte PORTF = 0xF85
#byte PORTG = 0xF86
|
|
|
|
sri... Guest
|
no output even though |
Posted: Thu Sep 17, 2009 12:22 am |
|
|
the undefined problem solved but no output the led's are always in off state. please help folks.... |
|
|
Ttelmah Guest
|
|
Posted: Thu Sep 17, 2009 3:02 am |
|
|
Use output_high, rather than bit_set (and low, instead of clear).
#define REL1 PIN_G6
output_high(REL1);
If your want to use bit_set, then it becomes _your_ responsibility to control TRIS. CCS does this for you, if you use it's output functions.
As it stands, TRIS is not being set, and defaults to 'input', so nothing will appear on the pins....
Best Wishes |
|
|
Sri... Guest
|
|
Posted: Mon Sep 21, 2009 11:10 pm |
|
|
thx Ttelmah..now its working, sorry for the delay response. |
|
|
|
|
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
|