PDA

View Full Version : PICKIT2 - PBC Pro - PIC16F88 TROUBLE



inventosrl
- 2nd December 2008, 20:47
Hello all, :D
today have buyed the pickit2dp and running, I've too mounted a 18 dip pin socket in a board connected with the ICSP signal.

It's all ok with pic 16f628 and an old hex file compiled with PBC 2.40 and MPASM 6.6, but with 16f88 compiled with PBC pro amd MPASM 8.10 have this alarm message

http://www.picbasic.co.uk/forum/attachment.php?attachmentid=2744&stc=1&d=1216305160

Also with a new project with PIC16f628 and this new compiler/assembler/programmer don't work.
I've tryed also to compile and program the micro but with the oscilloscope the micro seem dead, only the oscillator work.:mad:

I've tryed with PM and MPASM too, but i'm not able to include "PIC16F88" or
any Config for _XT_OSC and other

The code :
'************************************************* ***************
'* Name : CONTROLLER.BAS *
'* Author : Giorgio Rossi *
'* Notice : Copyright (c) 2008 Invento S.r.l. *
'* : All Rights Reserved *
'* Date : 26/11/2008 *
'* Version : 1.0 *
'* Notes : *
'* Chip : PIC16F88 *
'************************************************* ***************
INCLUDE "MODEDEFS.BAS"
TRISA = %00000001 'RA0 Input
TRISB = %00000000 'all PORTB output

ANSEL = %00000001'only porta.0 is analogue
ADCON1 = 7'right justify the result(top bits are read as zero)
CMCON = 7 'Turn off comparators


adval VAR BYTE
i var BYTE
RPM VAR BYTE

' Define ADCIN parameters
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
PAUSE 500

loop:
ADCIN 0,adval

serout PORTB.6,n2400, [$FE, 1]
serout PORTB.6,n2400, [$FE, 2, "pressione ", #adval]
serout PORTB.6,n2400, [$FE, $C0, "giri", #rpm]

IF adval < 90 THEN
HIGH PORTB.4
endif

IF adval > 120 THEN
LOW PORTB.4
endif

COUNT PORTA.2,250,RPM
for i = 1 to rpm
toggle PORTB.5
PAUSE 25
NEXT i
LOW PORTB.5
GOTO loop 'repeat

Any help will be apreciated,
Thanks a lot

giorgio

Archangel
- 2nd December 2008, 20:52
I've tryed with PM and MPASM too, but i'm not able to include "PIC16F88" or
any Config for _XT_OSC and other
You do not have to include pic16f88 if you are using MCS, it does it for you when you select 16f88 at the top of MCS, ELSEWISE it would have to be in the same directory as your code, in order to be found.
Please show us how you wrote the config statement exactly.

inventosrl
- 2nd December 2008, 21:07
You do not have to include pic16f88 if you are using MCS, it does it for you when you select 16f88 at the top of MCS, ELSEWISE it would have to be in the same directory as your code, in order to be found.
Please show us how you wrote the config statement exactly.

Hello Joe,
this line
@ __config _XT_OSC & _WDT_ON & _PWRTE_ON & _MCLR_ON & _BODEN_ON & _WRT_PROTECT_OFF

but in any case (with or without this config statement), have the same error and, after compiling and programming the micro don't work.

Thanks

inventosrl
- 2nd December 2008, 21:11
Joe, this it's the error of MCS Plus while try to compile with the config statement :

Error [126] c:\pbp\invento\contro~1.asm 101 : Argument out of range (not a valid config register address)

mackrackit
- 2nd December 2008, 22:29
Here is the top part of the code from a set up I have working.


'16F88
DEFINE OSC 8
OSCCON= %01110100

@__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB3 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF &_INTRC_IO

This is using the internal OSC, but you should get the idea.

You can look in the PicBasic inc file and the inc file in MPASM Suite for all of the possibilities.

Archangel
- 2nd December 2008, 23:42
Joe, this it's the error of MCS Plus while try to compile with the config statement :

Error [126] c:\pbp\invento\contro~1.asm 101 : Argument out of range (not a valid config register address)
OK, open the assembly file the error lists, I think your file is controller.bas, so open controller.asm and look at line 101 and see what it is objecting to. I will play with your code when I get back to my own computer.
EDIT: ok Tested and working with your code set for 4 mhz, as for the error, I get it too:

@ __CONFIG _CONFIG1, _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF & _MCLR_ON

inventosrl
- 3rd December 2008, 12:35
Hello, I use this :

PICBASIC PRO(TM) Compiler 2.50
MPASM V.5.2
MPLAB 8.10.00.00
MicroCode Studio Plus ver. 3.0.0.5
Pickit2 Application Version : 2.55.01
Device File Version : 1.53.00
OS Firmware Version : 2.32.00

the first's line of code:

'************************************************* ***************
'* Name : CONTROl.BAS *
'* Author : Giorgio Rossi *
'* Notice : Copyright (c) 2008 Invento S.r.l. *
'* : All Rights Reserved *
'* Date : 02/12/2008 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
@ __CONFIG _CONFIG1, _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF & _MCLR_ON
INCLUDE "MODEDEFS.BAS"

----- snip

MicroCode Studio Plus Error :
Error [118] c:\invento\control.asm 469 : Overwriting previus address contents (2007)

Line [118] :
_MCSBankEnd EQU MCSByte5

Thanks
giorgio

mackrackit
- 3rd December 2008, 15:26
See post #5 ;)

Archangel
- 3rd December 2008, 17:45
Hello, I use this :

PICBASIC PRO(TM) Compiler 2.50
MPASM V.5.2
MPLAB 8.10.00.00
MicroCode Studio Plus ver. 3.0.0.5
Pickit2 Application Version : 2.55.01
Device File Version : 1.53.00
OS Firmware Version : 2.32.00

the first's line of code:

'************************************************* ***************
'* Name : CONTROl.BAS *
'* Author : Giorgio Rossi *
'* Notice : Copyright (c) 2008 Invento S.r.l. *
'* : All Rights Reserved *
'* Date : 02/12/2008 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
@ __CONFIG _CONFIG1, _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF & _MCLR_ON
INCLUDE "MODEDEFS.BAS"

----- snip

MicroCode Studio Plus Error :
Error [118] c:\invento\control.asm 469 : Overwriting previus address contents (2007)

Line [118] :
_MCSBankEnd EQU MCSByte5

Thanks
giorgio
in the file you listed, the one from PBP 16f88.inc put a semicolon before this line, "<b> ;__config _CONFIG1, _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF</b> " that will cure the overwriting error. I have put one in here.

inventosrl
- 3rd December 2008, 20:35
See post #5 ;)

Hello Dave, the same erron on pickit2

mackrackit
- 3rd December 2008, 21:19
Here is your code with the configs added in. The PBP inc file has been commented out.
I even programmed a chip. I named the file "invent"


'************************************************* ***************
'* Name : CONTROLLER.BAS *
'* Author : Giorgio Rossi *
'* Notice : Copyright (c) 2008 Invento S.r.l. *
'* : All Rights Reserved *
'* Date : 26/11/2008 *
'* Version : 1.0 *
'* Notes : *
'* Chip : PIC16F88 *
'************************************************* ***************
Asm
ERRORLEVEL -306
ERRORLEVEL -205
Endasm
INCLUDE "MODEDEFS.BAS"
@__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB3 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF &_XT_OSC

TRISA = %00000001 'RA0 Input
TRISB = %00000000 'all PORTB output

ANSEL = %00000001'only porta.0 is analogue
ADCON1 = 7'right justify the result(top bits are read as zero)
CMCON = 7 'Turn off comparators


adval VAR BYTE
i var BYTE
RPM VAR BYTE

' Define ADCIN parameters
Define ADC_BITS 8 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
PAUSE 500

loop:
ADCIN 0,adval

serout PORTB.6,n2400, [$FE, 1]
serout PORTB.6,n2400, [$FE, 2, "pressione ", #adval]
serout PORTB.6,n2400, [$FE, $C0, "giri", #rpm]

IF adval < 90 THEN
HIGH PORTB.4
endif

IF adval > 120 THEN
LOW PORTB.4
endif

COUNT PORTA.2,250,RPM
for i = 1 to rpm
toggle PORTB.5
PAUSE 25
NEXT i
LOW PORTB.5
GOTO loop 'repeat

<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3041&stc=1&d=1228338867" />

inventosrl
- 3rd December 2008, 22:33
Hi Dave,
thanks a lot

please send me the file, so I can try.

What's the first line in assebler?

giorgio

inventosrl
- 3rd December 2008, 22:50
Hi Dave, I've look that you use MPASM,
please post me this file (16f88.inc)

thanks a lot

giorgio

inventosrl
- 3rd December 2008, 22:52
in the file you listed, the one from PBP 16f88.inc put a semicolon before this line, "<b> ;__config _CONFIG1, _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF</b> " that will cure the overwriting error. I have put one in here.

Hi Joe, don't work

mackrackit
- 3rd December 2008, 23:17
The file in the previous post is complete, just copy paste.


Hi Dave, I've look that you use MPASM,
Yep, I do not use anything else.


please post me this file (16f88.inc)
This is what it looks like.


NOLIST
ifdef PM_USED
LIST
include 'M16F88.INC' ; PM header
device pic16F88, hs_osc, wdt_on, lvp_off, protect_off
XALL
NOLIST
else
LIST
LIST p = 16F88, r = dec, w = -302
INCLUDE "P16F88.INC" ; MPASM Header
; __config _CONFIG1, _HS_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
NOLIST
endif
LIST

The ASM stuff
-306
Stops this message


Crossing page boundary -- ensure page bits are set.

Not needed for your code, just habit :)

-205
Takes care of


Found directive in column 1.

This is just a warning, but it is irritating.

inventosrl
- 3rd December 2008, 23:37
Very thanks Dave,
tomorrow morning I'm on duty.

nice night

giorgio