Hi you all:
I am from mexico, and I do apologize for my English, so I am new to programming, as a matter of fact this is my first intent, I have learned reading from posts on this forum and consulting the pbp and proteus manuals, the thing is that I wrote this code on pbp 2.6 and simulated it on proteus and works fine so i programmed the micro controller with masterprog (wich is a programmer that I got from Mercado libre, same than ebay over there) and when I put the micro on the protoboard nothing happened, and when I pressed the reset button and tree leds light up (00101010) and stay on and nothing else, I have tried reprogramming and checked al connections over and over again but noting seems to work, I have read many threads on this forum but I don’t find anything that can help, so I really will appreciate if any one look at the code and comment what I am doing wrong thanks very much in advance.
This is the code
'Note: This program it will light eight leds on nine different routines selectables by a button
@ DEVICE PIC16F877A, HS_OSC
@ DEVICE PIC16F877A, WDT_OFF
@ DEVICE PIC16F877A, PWRT_OFF
@ DEVICE PIC16F877A, BOD_OFF
@ DEVICE PIC16F877A, LVP_OFF
@ DEVICE PIC16F877A, CPD_OFF
@ DEVICE PIC16F877A, WRT_HALF
@ DEVICE PIC16F877A, DEBUG_ON
@ DEVICE PIC16F877A, PROTECT_OFF
tempo var byte ' set variables
cuenta var byte
x var byte
bot var byte
tempo= 50 ' set variables values
bot= 0
trisa= 0 ' set port's tris
trisb= 0
trisc= %00100000
trisd= 0
trise= 0
inicio: ' begining of routines
portb= %10101010 ' this loop makes odd and pair
pause tempo ' leds to turn on and off alternately
portb= %01010101
pause tempo
button portc.2,0,100,0,bot,1,una
goto inicio
una:
portb=%11111111 ' this loop makes all leds to turn
pause tempo ' on and off alternately
portb= %00000000
pause tempo
button portc.2,0,100,0,bot,1,dos
goto una
dos: ' this loop makes the leds to scroll
portb=%00011000 ' from the center outwards
pause tempo
portb= %00100100
pause tempo
portb= %01000010
pause tempo
portb= %10000001
pause tempo
button portc.2,0,100,0,bot,1,tres
goto dos
tres: ' this loop makes the leds scroll from the
portb=%10000001 ' sides inwards
pause tempo
portb= %01000010
pause tempo
portb= %00100100
pause tempo
portb= %00011000
pause tempo
button portc.2,0,100,0,bot,1,cuatro
goto tres
cuatro:
portb=%00001111 ' this loop makes leds to turn on and off four
pause tempo ' at the time
portb= %11110000
pause tempo
button portc.2,0,100,0,bot,1,cinco
goto cuatro
cinco:
cuenta=1 ' this loop makes leds to scrool from right
ciclo: ' to left
portb=cuenta
pause tempo
if cuenta= 128 then cinco
cuenta= cuenta*2
button portc.2,0,100,0,bot,1,seis
goto ciclo
seis:
cuenta=128 ' this loop makes leds to scroll from left
ultimo: ' to right
portb=cuenta
pause tempo
if cuenta= 0 then seis
cuenta= cuenta/2
button portc.2,0,100,0,bot,1,siete
goto ultimo
siete:
portb= %11000000 ' this loop makes leds to scroll on pairs from
pause tempo ' left to right
portb= %00110000
pause tempo
portb= %00001100
pause tempo
portb= %00000011
pause tempo
button portc.2,0,100,0,bot,1,ocho
goto siete
ocho:
portb= %00000011 ' this loop makes leds to scroll on pairs from
pause tempo ' right to left
portb= %00001100
pause tempo
portb= %00110000
pause tempo
portb= %11000000
pause tempo
button portc.2,0,100,0,bot,1,inicio
goto ocho
end
and this is the schematic from proteus
Bookmarks