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.

Trying to get started with my Junebug.. :)

Status
Not open for further replies.
Okay, adding in more lines of decfsz Count, f made it faster, not slower.

Don't understand how that could be.

Changing the line Count equ 0 had seemingly no affect...


Edit:
Is it because of the time taken to process a line of code, such as bra and return?

So because with four decfsz lines, it decrements 4x as much as with only one before "wasting time" processing bra and return?

If I called Delay twice, that should have the desired affect (slowing it down), right?



Edit 2:
It did!
 
Last edited:
Count equ 0 tells the assembler to place the variable count at location zero. It does not give it a value. Somewhere in the code it will give it a value but as you have only posted snippets we have no idea where. Post all the code and we may be able to help.

Mike.
 
Count equ 0 tells the assembler to place the variable count at location zero. It does not give it a value. Somewhere in the code it will give it a value but as you have only posted snippets we have no idea where. Post all the code and we may be able to help.

Mike.


I did post all the code, just in four "snippets".

Edit:
Code:
		List	p=18F1320
		include	<p18F1320.inc>
		CONFIG	OSC = INTIO2, WDT = OFF, LVP = OFF
LED		macro	x,y
		movlw	x
		movwf	LATA
		movlw	y
		movwf	TRISA
		call	Delay
		call	Delay
		call	Delay
		endm
		Count	equ 0
		org		0
		bsf		ADCON1, 0
LED1	LED b'00000001', b'10111110'
LED2	LED b'01000000', b'10111110'
LED3	LED b'01000000', b'00111111'
LED4	LED b'10000000', b'00111111'
LED5	LED b'10000000', b'01111110'
LED6	LED b'00000001', b'01111110'
		bra		LED1
Delay	decfsz	Count, f
		bra		Delay
		return
		END
 
Last edited:
Yeah so changing count equ just changed where the variable is stored in the ram.

Adding more Decfsz increased the speed as it decremented faster. The bra as you guessed takes longer. Two instruction cycles. But you could make this faster by assinging count a value of 0F prior to calling delay.

To make it longer you can just call count again or i prefer to put it in a second loop.
So:
Count2=0
Delay2
Goto delay
Decsfz count2
Goto delay2
Endm
 
Ok so for the next step, i suggest you make a program to read an input and change the status of an LED if input is high.

see how you get on.
 
Thanks for the help and sorry for the delay, I've been away.


Every time I try and write something myself I get a big red "build failed"... :(

I stripped it right back (maybe I was trying to be too ambitious, I thought) and still get build failed.


What's wrong with what I'm doing: (I don't mean that in a defensive way, something obviously is wron, I want to know what..)

Code:
List	p=18F1320
include	<p18F1320.inc>CONFIG	OSC = INTIO2, WDT = OFF, LVP = OFF
movlw	b'00000001'
movwf	TRISB
movwf	TRISA
btfss	PORTB,2
bsf		PORTA,6
end



Thanks!
 
Telling us you get "build failed" doesn't help. You also get an error description and a line number.

Your code, when formatted correctly, assembles fine.
Code:
		list	p=18F1320
		include	<p18F1320.inc>
		CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF
		movlw	b'00000001'
		movwf	TRISB
		movwf	TRISA
		btfss	PORTB,2
		bsf	PORTA,6
		end

Mike.
 
Last edited:
Your code, when formatted correctly, assembles fine.


Not for me, it doesn't:

Code:
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\PIC\LED.ASM 4 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\PIC\LED.ASM 5 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\PIC\LED.ASM 6 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\PIC\LED.ASM 7 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\PIC\LED.ASM 8 : Executable code and data must be defined in an appropriate section
 
Mike it worked fine for me the op has a lot more lines then he posted

Debug build of project `C:\Users\burt\Documents\junk\test.mcp' started.
Language tool versions: MPASMWIN.exe v5.41, mplink.exe v4.39, mplib.exe v4.39
Preprocessor symbol `__DEBUG' is defined.
Fri Jul 29 17:10:14 2011
----------------------------------------------------------------------
Make: The target "C:\Users\burt\Documents\junk\test.o" is up to date.
Make: The target "C:\Users\burt\Documents\junk\test.cof" is up to date.
Loaded C:\Users\burt\Documents\junk\test.cof.
----------------------------------------------------------------------
Debug build of project `C:\Users\burt\Documents\junk\test.mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.41, mplink.exe v4.39, mplib.exe v4.39
Preprocessor symbol `__DEBUG' is defined.
Fri Jul 29 17:10:16 2011
----------------------------------------------------------------------
BUILD SUCCEEDED

There only 26 that I found post your whole code and I'm sure mike will get you going
 
Last edited:
You are building it as relocatable code, go into Project->Build Options->Project and select the tab as attached.

Mike.
 

Attachments

  • absolute.png
    absolute.png
    39.9 KB · Views: 136
To me that looks like it doens't like the path to the files, try moving them to D:\Code or similar

Thats my best guess, might be wrong
 
You are building it as relocatable code, go into Project->Build Options->Project and select the tab as attached.

Mike.

I switched to absolute, still failing:

Code:
----------------------------------------------------------------------
Debug build of project `D:\Users\Ollie Ford\Dropbox\My Documents\PIC\led.mcp' started.
Language tool versions: MPASMWIN.exe v5.42, mplink.exe v4.40, mplib.exe v4.40
Preprocessor symbol `__DEBUG' is defined.
Thu Sep 08 22:14:48 2011
----------------------------------------------------------------------
Executing: "D:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p18F1320 "led.asm" /l"led.lst" /e"led.err" /o"led.o" /d__DEBUG=1
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\MY DOCUMENTS\PIC\LED.ASM 4 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\MY DOCUMENTS\PIC\LED.ASM 5 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\MY DOCUMENTS\PIC\LED.ASM 6 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\MY DOCUMENTS\PIC\LED.ASM 7 : Executable code and data must be defined in an appropriate section
Error[152]   D:\USERS\OLLIE FORD\DROPBOX\MY DOCUMENTS\PIC\LED.ASM 8 : Executable code and data must be defined in an appropriate section
----------------------------------------------------------------------
Debug build of project `D:\Users\Ollie Ford\Dropbox\My Documents\PIC\led.mcp' failed.
Language tool versions: MPASMWIN.exe v5.42, mplink.exe v4.40, mplib.exe v4.40
Preprocessor symbol `__DEBUG' is defined.
Thu Sep 08 22:14:49 2011
----------------------------------------------------------------------
BUILD FAILED
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top