1 Attachment(s)
This is my code and schematics
'************************************************* ********
'
' 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
Thank you very much for your help
I'l try as soon as possible.
Thanks again.
At last, the project is finished
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
Code:
@ 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.
Code:
'************************************************* ********
' 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