Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

symbol not defined OPTION_REG errors

Status
Not open for further replies.

SamanthaL

Junior Member level 2
Joined
Feb 4, 2009
Messages
20
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,474
option_reg

Hello everyone!

I"m trying to use RS-232 on the PIC18F4550. I wrote out the code already, but I'm getting errors saying that the following variables are not defined. I thought these were standard variables that shouldn't need to be defined. Do you know what the issue is?

variables generating errors:
INTF
FSR
SSPCON
INTEDG
PS2
PS1
PS0
OPTION_REG
RP0

I'm also getting errors with these variables, but I also get errors when I define them.

Warning[207] C:\SERIAL_1.ASM 137 : Found label after column 1. (xtal_freq)
Warning[207] C:\SERIAL_1.ASM 138 : Found label after column 1. (baudrate)
Warning[207] C:\SERIAL_1.ASM 139 : Found label after column 1. (spbrg_value)

Thank you in advance for you time!
 

symbol not previously defined in pic18f4550

I'm using the Microchip MPASM toolsuite on MPLAB.

Thanks for the prompt reply!
 

assembler + option_reg

they are standard, you need to first include the ,inc file..I have shown for 16F628
Code:
include "p16F628.inc"
 

the symbol is not defined

I'm using the PIC18F4550. Do I still need to include that inc file?
 

option_reg,ps2

u should use
include "p18F4550.inc"
and it will work

the warnings are ok... they are trying to make your code more neater thats all ignore them
 

    SamanthaL

    Points: 2
    Helpful Answer Positive Rating
change option_reg

That file is included. Does this mean my file is corrupt or something? Where can I download another copy to test this?

I just looked in the P18F4550.inc file. It doesn't contain OPTION_REG. Is this normal? I have two copies of the file on my computer and neither one includes it.
 

symbol not previously defined (option_reg) asm

The p18f4550 does not have an option register.
This register is usually used on the mid range devices to set up the Timer_0/WDT prescaler and the interrupt enables for the int pin, timer0, port b change and their interrupt flags.
On the pic18, these have their own registers.

Also, never ignore compiler warnings unless you understand what they are saying and it will not affect your code!
Those warnings sound like your variables are being interpreted as labels?
 

    SamanthaL

    Points: 2
    Helpful Answer Positive Rating
microchip bcf option_reg

I'm trying to write an RS-232 implementation on this pic.

How would these lines be done in the PIC18 then? And what do those other symbol not found errors translate to?

bsf OPTION_REG,NOT_RBPU
bsf OPTION_REG,INTEDG
bcf OPTION_REG,T0CS
bcf OPTION_REG,T0SE
bcf OPTION_REG,PSA
bcf OPTION_REG,PS2
bsf OPTION_REG,PS1
bsf OPTION_REG,PS0

I've attached my code for context information.
 

symbol not previously defined (portb.0)

This code must of been written for a different device.

bsf OPTION_REG,NOT_RBPU 'Port B pull up enable
bsf OPTION_REG,INTEDG 'Interrupt on rising edge of int pin
bcf OPTION_REG,T0CS 'Timer 0 source internal clock
bcf OPTION_REG,T0SE 'Increment on low to high transistion
bcf OPTION_REG,PSA 'Prescaler assigned to Timer 0
bcf OPTION_REG,PS2 'Prescale rateselect bits 1:16
bsf OPTION_REG,PS1
bsf OPTION_REG,PS0

All this is done differently in a pic18.
Microchip do a tool to generate code called 'Application Maestro' available here

**broken link removed**

This will generate uart code for a pic18.

Its a pretty crappy tool but should get you started.
 

    SamanthaL

    Points: 2
    Helpful Answer Positive Rating
pic assembly option_reg

Thank you for the tip on the software. Unfortunately, it only provides code in C. I'm working in Assembly. I've decided to switch to a PIC16 which I am a little more familiar with. I've created another post called rs232 to deal with issues I'm having there. Thank you everyone for your help!
 

found label after column 1.

The application maestro generates the code in c or assembler!
You can choose between them.
 

    SamanthaL

    Points: 2
    Helpful Answer Positive Rating
symbol not previously defined+mplab+pic18f

Go to the Microchip website and download the manual for your device. On inspection you will find that this device does not have an OPTION_REG which is why you compiler does not recognise it. The manual will indicate what bits you will need to set and in what register you will find them for your device. Good luck!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top