Flow Code and PIC problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
emrekaya
Posts: 7
Joined: Thu Aug 02, 2007 8:13 pm

Flow Code and PIC problem

Post by emrekaya »

Hi,

I bought the FlowCode just a few weeks ago for a company project.
I am working on a PIC16F628-04/P. For the programmer i am using a DIY programmer with 74LS05. Up to now I had no problems with uploading the HEX files.


My problem is:

It seems that all the codes for 16f628-04/P doesnt work correctly.

I made a simple turn port A (full port) on delay 1 sec turn it off.

Here is the configuration

Frequency 4000000
OSC: INTRC I/O
Watchdog Timer:OFF
Powerup Timer :OFF
Brown Oout Detect:ON
Master Clear Enable :OFF
Low Voltage Program:ON
Data EE Read Protect:Off
Code Protect :Off
Hex Configuration : 0X3E18

When I try to compile this with MPASM the error is:
CORE-E0002: Stack under flow error occurred from instruction at 0x000804

I am totally confused ? Am i doing something wrong or is there a compability problem with 16F628-04/p

And here is the ASM
;/////////////////////////////////////////////////////////////////////////////////
;// Code Generator: BoostC Compiler - http://www.sourceboost.com
;// Version : 6.70
;// License Type : Pro License
;// Limitations : PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited
;/////////////////////////////////////////////////////////////////////////////////

include "P16F628.inc"
; Heap block 0, size:96 (0x000000A0 - 0x000000FF)
__HEAP_BLOCK0_BANK EQU 0x00000001
__HEAP_BLOCK0_START_OFFSET EQU 0x00000020
__HEAP_BLOCK0_END_OFFSET EQU 0x0000007F
; Heap block 1, size:78 (0x00000022 - 0x0000006F)
__HEAP_BLOCK1_BANK EQU 0x00000000
__HEAP_BLOCK1_START_OFFSET EQU 0x00000022
__HEAP_BLOCK1_END_OFFSET EQU 0x0000006F
; Heap block 2, size:48 (0x00000120 - 0x0000014F)
__HEAP_BLOCK2_BANK EQU 0x00000002
__HEAP_BLOCK2_START_OFFSET EQU 0x00000020
__HEAP_BLOCK2_END_OFFSET EQU 0x0000004F
; Heap block 3, size:0 (0x00000000 - 0x00000000)
__HEAP_BLOCK3_BANK EQU 0x00000000
__HEAP_BLOCK3_START_OFFSET EQU 0x00000000
__HEAP_BLOCK3_END_OFFSET EQU 0x00000000
gbl_status EQU 0x00000003 ; bytes:1
gbl_indf EQU 0x00000000 ; bytes:1
gbl_tmr0 EQU 0x00000001 ; bytes:1
gbl_pcl EQU 0x00000002 ; bytes:1
gbl_fsr EQU 0x00000004 ; bytes:1
gbl_porta EQU 0x00000005 ; bytes:1
gbl_portb EQU 0x00000006 ; bytes:1
gbl_pclath EQU 0x0000000A ; bytes:1
gbl_intcon EQU 0x0000000B ; bytes:1
gbl_pir1 EQU 0x0000000C ; bytes:1
gbl_tmr1l EQU 0x0000000E ; bytes:1
gbl_tmr1h EQU 0x0000000F ; bytes:1
gbl_t1con EQU 0x00000010 ; bytes:1
gbl_tmr2 EQU 0x00000011 ; bytes:1
gbl_t2con EQU 0x00000012 ; bytes:1
gbl_ccpr1l EQU 0x00000015 ; bytes:1
gbl_ccpr1h EQU 0x00000016 ; bytes:1
gbl_ccp1con EQU 0x00000017 ; bytes:1
gbl_rcsta EQU 0x00000018 ; bytes:1
gbl_txreg EQU 0x00000019 ; bytes:1
gbl_rcreg EQU 0x0000001A ; bytes:1
gbl_cmcon EQU 0x0000001F ; bytes:1
gbl_option_reg EQU 0x00000081 ; bytes:1
gbl_trisa EQU 0x00000085 ; bytes:1
gbl_trisb EQU 0x00000086 ; bytes:1
gbl_pie1 EQU 0x0000008C ; bytes:1
gbl_pcon EQU 0x0000008E ; bytes:1
gbl_pr2 EQU 0x00000092 ; bytes:1
gbl_txsta EQU 0x00000098 ; bytes:1
gbl_spbrg EQU 0x00000099 ; bytes:1
gbl_eedata EQU 0x0000009A ; bytes:1
gbl_eeadr EQU 0x0000009B ; bytes:1
gbl_eecon1 EQU 0x0000009C ; bytes:1
gbl_eecon2 EQU 0x0000009D ; bytes:1
gbl_vrcon EQU 0x0000009F ; bytes:1
delay_ms_00000_arg_del EQU 0x00000021 ; bytes:1
delay_s_00000_arg_del EQU 0x00000020 ; bytes:1
ORG 0x00000000
GOTO _startup
ORG 0x00000003
delay_ms_00000
; { delay_ms ; function begin
MOVF delay_ms_00000_arg_del, F
BTFSS STATUS,Z
GOTO label4026531857
RETURN
label4026531857
MOVLW 0xF9
label4026531858
ADDLW 0xFF
BTFSS STATUS,Z
GOTO label4026531858
NOP
DECFSZ delay_ms_00000_arg_del, F
GOTO label4026531857
RETURN
; } delay_ms function end

ORG 0x0000000F
delay_s_00000
; { delay_s ; function begin
label4026531863
MOVLW 0xFA
MOVWF delay_ms_00000_arg_del
CALL delay_ms_00000
MOVLW 0xFA
MOVWF delay_ms_00000_arg_del
CALL delay_ms_00000
MOVLW 0xFA
MOVWF delay_ms_00000_arg_del
CALL delay_ms_00000
MOVLW 0xFA
MOVWF delay_ms_00000_arg_del
CALL delay_ms_00000
DECFSZ delay_s_00000_arg_del, F
GOTO label4026531863
RETURN
; } delay_s function end

ORG 0x0000001E
main
; { main ; function begin
MOVLW 0x07
BCF STATUS, RP0
BCF STATUS, RP1
MOVWF gbl_cmcon
MOVLW 0xC0
BSF STATUS, RP0
MOVWF gbl_option_reg
CLRF gbl_trisa
BCF STATUS, RP0
CLRF gbl_porta
BSF STATUS, RP0
CLRF gbl_trisa
MOVLW 0x01
BCF STATUS, RP0
MOVWF gbl_porta
MOVWF delay_s_00000_arg_del
CALL delay_s_00000
BSF STATUS, RP0
CLRF gbl_trisa
BCF STATUS, RP0
CLRF gbl_porta
label268439632
GOTO label268439632
; } main function end

ORG 0x00000034
_startup
BCF PCLATH,3
BCF PCLATH,4
GOTO main
ORG 0x00002007
DW 0x3E18
END

Thank you very much
and
Have a nice day

Emre Kaya
Electrical And Electronics Engineer
ProtoSAN
http://www.Protosan.com

MSN:emrekaya@protosan.com

emrekaya
Posts: 7
Joined: Thu Aug 02, 2007 8:13 pm

Post by emrekaya »

Hi again

I corrected the problem. IT Seems that our whole lot is damged. I tried to
check the whole lot with a prof. programmer and got errors on ll the chips.
Ordered a new lot and everything is fine =D

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hello

Glad your problem has been sorted out.

Post Reply