Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Timer0 of PIC18F452

Status
Not open for further replies.
Hi,

I am trying to create a counter for timing purposes using the 16-bit timer of the PIC18F452 with a 4MHz clock. However, everytime i try to assemble the code i keep getting this one error shown below:

Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.

I google this error and tried a lot of the responses like setting the paths in Project > build > build option of MPLAB but still get the same error each time.

The code is attached. Can anyone help please.
 

Attachments

  • Timer using timer 0 in 16 bit mode 4Mhz clock.txt
    3.1 KB · Views: 500
mcc18? Sounds like you're using a C compiler to compile ASM.
 
Error - could not find definition of symbol 'main' in file 'C:\MCC18\lib/c018i.o'.

This tells you that the problem is not with the code but with the way your project is setup.

The library path is not pointing to
C:\MCC18\lib where the c018i.o file is found

Did you create a project. If so look at
PROJECT>SELECT LANGUAGE TOOL LOCATIONS>
Microchip C18 Toolsuite>Default Search Paths & Directories

Make sure the lib path is set as above.
 
Timer Update

Thanks 3vo,

I changed the diretories and that seemed to solved the ".o" error but getting two new errors:

Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F452 "TimerNew.asm" /l"TimerNew.lst" /e"TimerNew.err" /d__DEBUG=1
Warning[205] C:\DARRELL\TIMERNEW.ASM 38 : Found directive in column 1. (global)
Error[149] C:\DARRELL\TIMERNEW.ASM 38 : Directive only allowed when generating an object file
Warning[205] C:\DARRELL\TIMERNEW.ASM 40 : Found directive in column 1. (radix)
Error[149] C:\DARRELL\TIMERNEW.ASM 51 : Directive only allowed when generating an object file

The errors point to these tw3o lines:

global d_1_ms, d_10_ms, d_100_ms, d_1_sec

&

d_code code

from the intial attached notepad file containing the code. Any help with this please :(
 
I think Sceadwian is right, it looks like you're trying to compile a relocatable assembler source file. I don't use "relocatable" mode yet so I'm afraid I can't be much help telling you how to setup a "relocatable" assembler project.

Mike
 
Last edited:
Timer Update.

Wel i knew there was an option between absolute and rellocatacble code and i choose absolute but knew nothing about that...was advised by a friend who knew more than me...but we are stuck here now...I founf this code online and change it up to my specifications...Any idea what to do from here now?...Taking a look at the MPASM manual at the moment to try to find something helpful.
 
Timer0 Build Succeded

Hi,

I finally got the code to build successfully after reading the article from:

Member Homepage for JWN-hotmail-f41

I posted the changes made...From this i gather that all this code does is generate a delay of 1 sec ... right? ... How to i use this to create a counter that will count from one to sixty then roll over to minutes then hours ... I am trying to create a counter to count the lenght of time a person stays on the phone...So my counter would be initiated when i realized the phone goes off hook and stops when the phone returns on hook.

From thinking it thru i think i would need to create something like this:

While (Off_Hook = 1) // When the phone is detected as being Off the hook
Initiate Timer
Keep running timer until On-Hook is sense.
end

How do i write this in code to display to an LCD???
 

Attachments

  • Build Succeded Timer0.txt
    2.7 KB · Views: 325
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top