Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GLOW LEDS IN ALTERNATE PATTERN ASSEMBLY CODE WARNINGS

Status
Not open for further replies.

X4ROY

Newbie level 6
Joined
Jun 4, 2010
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Bangalore
Activity points
1,416
OBJECTIVE : GLOW LEDS CONNECTED TO PORTB ONE AFTER ANOTHER IN A DEFINITE PATTERN.
PROBLEM: ASSEMBLY CODE IS FULL OF WARNINGS , IS IT NECESARY TO TELL THE ASSEMBLER THE ADDRESS OF PORTB ??
NOTE: WILL THE CODE CHANGE FOR PIC18F48 AND PIC16877A

SOURCE CODE :

MYREG EQU 0X08;
ORG 0;
CLRF TRISB; set port b as output port
START CLRF PORTB; port b = 0000000 so all leds are off
BSF PORTB,0; put on led connected to port rb0
CALL DELAY
CLRF PORTB; all leds are again off
BSF PORTB,1; put on led connected to port rb1
CALL DELAY
CLRF PORTB;
BSF PORTB,2;
CALL DELAY
CLRF PORTB;
BSF PORTB,3;
CALL DELAY
CLRF PORTB;
BSF PORTB,4;
CALL DELAY
CLRF PORTB;
BSF PORTB,5;
CALL DELAY
CLRF PORTB;
BSF PORTB,6;
CALL DELAY
CLRF PORTB;
BSF PORTB,7;
CALL DELAY
GOTO START;
;
DELAY MOVLW 0XFF; delay subroutine
MOVWF MYREG;
AGAIN NOP;
NOP
DECF MYREG ,F
BNZ AGAIN;
RETURN;
END;

Added after 43 seconds:

PLEASE LET ME KNOW WHICH TOOL SUITE I SHOULD SELECT IN MPLAB IDE PROJECT WIZARD TO ASSEMBLE THE CODE .
 

Hi,


Good try, but you need a lot more to make it work.

Have attached a usable .asm file together with the full project files which were made with Mplab 8.46 so any version the same of higher should read it ok ( not sure about older versions)

Your delay is way too short to be visually seen, you can get longer delays from this handy link, sugest you use 250ms to start with so you can see the leds change.
When you get into things more, you can use the SIMulator and StopWatch to check the time the delays take.

**broken link removed**
 

    X4ROY

    Points: 2
    Helpful Answer Positive Rating
DUDE SOMETHING WRONG IN THE HARDWARE ITS NOT WORKING THE CONNECTIONS ARE CORRECT ..
THE LEDS ARE NOT GLOWING U MAY ALSO GIVE ME A C CODE FOR THE SAME .....
 

Hi,

Can you send your completed assembler code across showing which chip you are using and what frequency crystal you are using.

Have you increased the delay time ?

How are you connecting your leds ?

Are you using actual hardware or a simulator ro run your code ?
 

    X4ROY

    Points: 2
    Helpful Answer Positive Rating
dude im using PIC 16F877A ... FREQUENCY IS 16MHZ .... IM USING ACTUAL HARDWARE ..... U R CODE IS PERFECT SOMETHING WRONG WITH MY HARDWARE IF I PRESS THE OSCILLATOR AND THE TWO CAPACITORS THEN ITS WORKING BEAUTIFULLY .... ONCE I LEAVE IT SOME LOOSE CONNECTION I BOUGHT IT RECENTLY FULLY FABRICATED ..... CANT FIND OUT WHAT'S WRONG IF I PUSH THE BOARD OR JERK IT ALL OF A SUDDEN IT STARTS WORKING THEN STOPS
 

Hi,

Sounds like you have a dry joint, have not got the pic seated fully in the socket or some pins bent under, or a faulty crystal.

If you are handy with the soldering iron I would go around and resolder the crystal and its caps and the dil 40 pin socket.
If that does not work, resolder around all the power components like the inputs sockets, caps , vregulator etc.

Just incase its also partly software this hex file turns all of PortB on an off one every two seconds at 16meg

good luck
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top