Tema: PIC programavimas
Autorius: tarzan
Data: 2010-04-19 17:11:16
Kas galetu kas pasakyti, ar sito kodo uztektu uzprogramuoti cipa, ar cia ne 
pilnas kodas? Kas nepatinka programai del "Input2" (del jo trys error)?
Ar siek tiek pakeitus sita koda, galima butu panaudoti kitam cipui?

";--------------------------------------------------------------------------
; MadLab PIC Basic Compiler (www.madlab.org)
; Assemble using Microchip MPLab (www.microchip.com)
;--------------------------------------------------------------------------

	list p=16F627

	errorlevel -305

;--------------------------------------------------------------------------
; registers/variables
;--------------------------------------------------------------------------

INDF			equ	h'00'	; 8u
TMR0			equ	h'01'	; 8u
PCL			equ	h'02'	; 8u
STATUS			equ	h'03'	; 8u
FSR			equ	h'04'	; 8u
PORTA			equ	h'05'	; 8u
PORTB			equ	h'06'	; 8u
PORTC			equ	h'07'	; 8u
PCLATH			equ	h'0A'	; 8u
INTCON			equ	h'0B'	; 8u
OPTION			equ	h'81'	; 8u
TRISA			equ	h'85'	; 8u
TRISB			equ	h'86'	; 8u
TRISC			equ	h'87'	; 8u
b0			equ	h'20'	; 8u
b1			equ	h'21'	; 8u
_temp1			equ	h'22'	; 8u


	org h'0000'

;--------------------------------------------------------------------------
; stub code
;--------------------------------------------------------------------------


;--------------------------------------------------------------------------
; user code
;--------------------------------------------------------------------------

				; symbol x = b0
				; symbol z = b1
				; symbol Input2 = pin2
;*** Not a constant expression in line #3 ***
main
	clrf b0			; let x = 0
	clrf b1			; let z = 0
label0			; if Input2 = 1 then label1
;*** Syntax error in line #8 ***
	movfw b1		; if z <> 1 then label2
	sublw 1
	movlw 0
	skpz
	movlw 1
	iorlw 0
	skpz
	goto label2
	goto label0		; goto label0
label2
	tstf b0			; if x <> 0 then label3
	movlw 0
	skpz
	movlw 1
	iorlw 0
	skpz
	goto label3
label4
	clrf b0			; let x = 0
				; low 0
	goto label0		; goto label0
label3
	movfw b0		; if x <> 6 then label5
	sublw 6
	movlw 0
	skpz
	movlw 1
	iorlw 0
	skpz
	goto label5
	goto label4		; goto label4
label5
	movlw 1			; let z = 1
	movwf b1
	goto label0		; goto label0
label1			; high 0
	movfw b1		; if z = 1 then label6
	sublw 1
	movlw 1
	skpz
	movlw 0
	iorlw 0
	skpz
	goto label6
	movfw b0		; if x <= 5 then label7
	sublw 5
	movlw 1
	skpc
	movlw 0
	iorlw 0
	skpz
	goto label7
	goto label0		; goto label0
label7
	incf b0			; let x = x + 1
	goto label0		; goto label0
label6
	clrf b1			; let z = 0
	clrf b0			; let x = 0
label8			; if Input2 = 1 then label8
;*** Syntax error in line #27 ***
	goto label0		; goto label0
	goto label8		; goto label8
	goto _end_prog

;--------------------------------------------------------------------------
; library routines
;--------------------------------------------------------------------------

_end_prog


;--------------------------------------------------------------------------
; EEPROM data
;--------------------------------------------------------------------------


	end