PDA

View Full Version : Beginer problems



luxornet
- 1st February 2010, 13:11
Hi!
I just started to explore Microchip PIC and I have a huge problem.
I am very satisfactory with writing code in PicBasic, to simulate different schematics in Proteus, to program different microchip pic (12F629, 16F628) with a JDM programmer and verify, but my problem is that when I make the schematic on a breadboard (solderless board) nothing works!
I used a 9V battery, ULN7805+10uF+0.1uF, a 12F629 (and later 16F628) and tried to flash a led on one microcontroller pin + 330 ohmi resistor.
Do you know what can be wrong?

The microcontroller seems to be well programed (and verified), the power supply is stable, same schematic works well in proteus (and many more other schematics with microcontrollers) ...
The JDM programmer was bought from a local store...
I don't use any anti-static tools.
Thank you very much!

Acetronics2
- 1st February 2010, 13:33
Hi, Luxor

Welcome aboard the Forum !

Could you post here one of the codes you tried ???

Will be much, much, much simpler to find what you've forgotten ...

Alain

luxornet
- 2nd February 2010, 17:52
'************************************************* ********
'
' LED FLASHING PROGRAM
' ======================
'
' This program flashes an LED connected to port RB0 of PORTB. The
' LED is flashed with 1 second intervals.
'************************************************* ************
'
LED VAR PORTB.0 ' Define RB0 as LED
'
' START OF MAIN PROGRAM
'
TRISB = 0 ' Set PORTB pins as outputs
AGAIN:
LED = 1 ' Turn ON LED
PAUSE 1000 ' Wait 1 second
LED = 0 ' Turn OFF LED
PAUSE 1000 ' Wait 1 second
GOTO AGAIN ' Repeat forever
END ' End of program

Acetronics2
- 2nd February 2010, 18:17
Ok Luxor

Bingo : You simply forgot to write the chip A/D relevant registers config and define I/Os for your chip ...




DEFINE OSC 4 ' Default Osc freq
DEFINE OSCCAL_1K 1 ' retrive the trimming value

CMCON = 7 ' disable Analog comparators

GPIO = %00000000 'All pins LOW at startup

TRISIO =%00101000 'set GPIO3 & GPIO5 as inputs



so, add those lines to the top of code.

AND do not forget to connect the RESET PIN ...

a look to the 629 Datasheet will help !

Alain

luxornet
- 3rd February 2010, 04:52
I'l try as soon as possible.
Thanks again.

luxornet
- 4th February 2010, 18:06
I had many problem and brain damage because I used MPASM as assembler instead of PM.EXE (I used MicroCode Studio too). Simply line like

@ device pic16F628, intrc_osc_noclkout
gave me strange error codes...
But now, the project is working. I hope somebody find it useful.
Thanks all of you for help.


'************************************************* ********
' LED FLASHING PROGRAM
' ======================
' PIC16F628 20I/P
' Pic Basic Pro Compiler 2.45, (c) 1998, 2004 microEngineering Labs, Inc.
' Assembler used is PM.EXE, provided with microEngineering Labs PICBasic Compiler
'
' This program flashes an LED connected to port RB0 of PORTB. The
' LED is flashed with 1 second intervals.
'************************************************* ************
'
INCLUDE "modedefs.bas"
'
@ device pic16F628, intrc_osc_noclkout; Use internal oscilator
@ DEVICE pic16F628, MCLR_OFF ; Turn off internal reset (default) and leave RA.5 as an input
'
DEFINE OSC 4 ' Default Osc freq
CMCON = 7 ' PortA = digital I/O
VRCON = 0 ' A/D Voltage reference disabled
TRISB = %00000000 ' PORTB all pins outputs
'
' Define RB0 as LED (pin number 6):
LED VAR PORTB.0
' VSS - pin number 5 (Ground)
' VDD - pin number 14 (+5V)
' MCLR (pin number 4) pulled-up to VDD by 4.7Ko resistor
'
'program start
AGAIN:
LED = 1 ' Turn ON LED
PAUSE 1000 ' Wait 1 second
LED = 0 ' Turn OFF LED
PAUSE 1000 ' Wait 1 second
GOTO AGAIN ' Repeat forever
END ' End of program

Acetronics2
- 4th February 2010, 20:00
Hi,Luxor

I see on your listing you missed that :

http://www.melabs.com/downloads/P245A1.EXE

this is an official patch for your PBP 2.45 version ...

Alain

luxornet
- 5th February 2010, 04:55
:confused:
Thank you very much, Alan.