EB006 test program is the only programe that loads

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: EB006 test program is the only programe that loads

Post by Steve »

Hi Chloe,

The "slow mode" board is currently in production and will be ready when the course is released. As per my email, we will send one of these out to you with a 16F88 chip, along with the updated course.

The reason for not supporting the 16F1937 is that this chip's i/o works in a different way to the earlier chips like the 16F84a / 16F88 / 16F877a. Our assembly course is designed for beginners and so we felt it would cause too much confusion to support both the old and new chips. Once you have learnt the basics on a chip like the 16F88, it should be a lot simpler to transfer your knowledge to the 16F1937.

The 16F1937 can easily be removed and replaced with the 16F88 chip that we'll send you.

Regards,
Steve.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: EB006 test program is the only programe that loads

Post by medelec35 »

Hi Chloe,
Just had a thought.
There is a command in assembly called

Code: Select all

CALL
This allows you to call a

Code: Select all

label

There is also a command called

Code: Select all

RETURN
That sensds the program back to next line down after the CALL.
So what you can do to make life a little easier before new add on board arrives is instead of multiple Delays of:

Code: Select all

movlw	0x0	
	movwf DELAY;
Delay_0
 	DECFSZ	DELAY, f
 	GOTO	Delay_0
,

Code: Select all

movlw	0x0	
	movwf DELAY
Delay_1
 	DECFSZ	DELAY, f
 	GOTO	Delay_1	
etc..
You can just call the one delay as many times as you like.
For example :

Code: Select all

; TUTA3.ASM  27SEP07

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
; Configuration data 
; PICmicro MCU type: 16F1937 
; Oscillator: Oscillator: XTAL mode
; LCD display: off 
; 7-segment display: off 
; Version 3 board settings: J14 links: Digital 
;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;
; The following lines embed configuration data into the PICmicro
	LIST P=16F1937
  __CONFIG H'8007', H'FE4'  ; Internal osc mode
   __CONFIG H'8008', H'1EFF' 
 #DEFINE   BANK0   MOVLB 0
 #DEFINE   BANK1   MOVLB 1
 #DEFINE   BANK2   MOVLB 2

;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: 
	DLY	EQU	H'20'	


; using names to ease writing of TUTA2
				

	PORTB	EQU	H'0D'		; name program location 13 as PORTB
	LATB    EQU	H'10D'
				
	ORG	0		; Reset vector
	GOTO	5		; Goto start of program
	ORG	4		; Interrupt vector
	GOTO	5		; Goto start of program
	ORG	5		; Start of program memory
	CLRF	PORTB		; clear Port B data pins
	BANK1		; Page 1
	MOVLW	0x07
	MOVWF	H'99'		; Setup the OSCCON register to set int osc at 31KHz
	CLRF	H'9E'		; Setup the ADCON1 register
	CLRF	PORTB		; set all Port B as output via Page 1
	BANK2		
				
LOOPIT	BSF	LATB,0		; set Port B pin 0 to logic 1	
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	BSF	LATB,1		; set Port B pin 1 to logic 1
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 	
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	BSF	LATB,2		; set Port B pin 2 to logic 1
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	BSF	LATB,3		; set Port B pin 3 to logic 1
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	BSF	LATB,4		; set Port B pin 4 to logic 1
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	BSF	LATB,5		; set Port B pin 5 to logic 1
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	BSF	LATB,6		; set Port B pin 6 to logic 1
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. oto	Delay_6
	BSF	LATB,7		; set Port B pin 7 to logic 1
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	CLRF LATB		; clear all PORTB pins
	CALL DELAY          ;Goto the DELAY subroutine then when reaches a RETURN command goto next line down. 
	GOTO	LOOPIT		; goto address LOOPIT

DELAY					;Label Location address.
           CLRF  DLY
Delay_0
 	DECFSZ	DLY, f
 	GOTO	Delay_0	
	RETURN	        ;Return to the next line from CALL command		
	END			; final statement
It makes the code much shorter and easier to manage.

Martin
Attachments
E03 V2.asm
(2.78 KiB) Downloaded 375 times
Martin

Post Reply