+ Reply to Thread
Results 1 to 11 of 11

Thread: Student with the pic blues, all code, no action

  1. #1
    rostifa Newbie
    Join Date
    Mar 2006
    Posts
    4

    Default Student with the pic blues, all code, no action

    Hi, i'm a newcommer to the world microcontrollers and started on my first (hopefully of may) pic project for my final year in university, using the PIC16F877. The project involves creating a 'laser' targeting system for model aircraft. I have used infrared techniques used in lazer quest games for the system coupled with a nice pair of tranceiver modules and an LCD.

    Anyway, after months researching and designing the code, all was good. I write the code in CCS and modeled my design (well the LCD anyway) in proteus VSM and it worked great. Finally last week i committed my design to silicone, before placing in my PCB only for nothing to happen!! :-(.

    The LCD just produced 20 black squres and nothing else. On trying to debug i found that i had used 33uf instead of pf oscillator capacitors and changed them. Still nothing. So on the advice of one of the techs i wrote basic code just to turn on and off LEDs attached to portA. This seemed to work on the ICD demo board, but again not in my PCB?

    After reading the notes for the forum i realise the LED on RA4 wouldnt work anyway because it is open drain type but i dont know why the rest dont. I have disabled the analogue inputs and made sure the tris is correct. There deffinately is 5V to the PIC. Do you think i could have damaged the 4Mz Xtal (XT setting) with the wrong caps? Maybe that would explain why nothing is happening. I am REALLY lost now. Even the uni tech couldnt help. So if one of you can, or has any advice, please, please help!!!....

    Ross


  2. #2
    eblc1388 Excellent eblc1388 Excellent eblc1388 Excellent eblc1388 Excellent eblc1388 Excellent
    Join Date
    Jan 2005
    Location
    UK
    Posts
    2,226

    Default

    You have to post your LED flashing code here for us to look at, using the [c o d e] forum format code so that the spacing in the ASM file are retained.
    L.Chung

  3. #3
    Super Moderator Jay.slovak Good Jay.slovak Good Jay.slovak Good
    Join Date
    Jan 2005
    Location
    Slovakia
    Posts
    1,740

    Default

    Finally somebody who reads the Sticky first!

    Post us your code, schematic and a PCB image. That's the minimum we need to help you.

    Jay.

  4. #4
    rostifa Newbie
    Join Date
    Mar 2006
    Posts
    4

    Default

    Uh, ok i will try, but i think the problem lies in the hardware as the program works on portc in the MPLab ICD demo board, but when i change the code to porta, beging careful to ensure i turn the pins to digital IO and set the tris correctly is doesnt work in my PCB. As there is definatley power i figured it might be the oscillator. I supose i should try checking this on a scope but im not sure ehat levels i should be looking for. The frequency is 4mhz. I just wondered if anyone has any advice on hardware issues.

    I did at one point forget a series res in with an LED on port A ops: . I know port c still works but would this blow all of port A maybe?..

    Will try an get the code up soon.

    PS I have proteus VSM 5.2. This runs the simulations with the LCD ok but i cant view the source code as it was created through CCS C compiler in MPLAB. Is there any way to do this, or do i need to upgrade to a newer version?

    Cheers Ross

  5. #5
    Super Moderator Jay.slovak Good Jay.slovak Good Jay.slovak Good
    Join Date
    Jan 2005
    Location
    Slovakia
    Posts
    1,740

    Default

    Quote Originally Posted by rostifa
    I did at one point forget a series res in with an LED on port A ops: . I know port c still works but would this blow all of port A maybe?..
    It's improbable. PICs are pretty sturdy devices so LEDs shouldn't hurt them (if you do not abuse them like this for extensive periods of time).

  6. #6
    mstechca Bad
    Join Date
    Mar 2003
    Location
    Why do you care?
    Posts
    1,598

    Default

    if you have not done so, make sure that:

    You send the appropiate initialization commands to the LCD. This is required before the LCD can display any characters. If yours is a text-based LCD and it has 14 or 16 connection points, then it might contain an HD47780 chip. You can do a search on the internet for this kind of information and you will find out how to use it.

    you must limit current! This is VERY important, and applies to every circuit built. If current was not limited, the load (whatever is consuming battery power, such as lights) is more than likely to be destroyed. You might want to replace the LCD in your case.

    Does ANY part of your project work the way you expected it to?
    -=: The best low-priced components to troubleshoot with are the speaker and the LED :=-

  7. #7
    rostifa Newbie
    Join Date
    Mar 2006
    Posts
    4

    Default Hmm

    After replaceing my oscillator caps that were incorrectly stamped i found the circuit would work with a pic16f877a but not the normal 877s i had bought. Does anybody know what the difference is between the two and why things will not work on the normal 877. I used CCS C complier through MPLab to create the hex files and these were set to the correct chip version, so i cant see where the problem lies. Anybody know...

    Please help, Ross

  8. #8
    Oznog Excellent Oznog Excellent Oznog Excellent Oznog Excellent Oznog Excellent
    Join Date
    Apr 2004
    Location
    Austin, Tx
    Posts
    2,766

    Default

    You need to start small. Write code that turns one pin on and off in the main code loop and turns another pin on and off with interrupts. Rather than strobing, you want to use RB1=!RB1 so it maintains a more observable ~50% duty cycle. You need an oscilloscope to view it.

    Quote Originally Posted by mstechca
    you must limit current! This is VERY important, and applies to every circuit built. If current was not limited, the load (whatever is consuming battery power, such as lights) is more than likely to be destroyed. You might want to replace the LCD in your case.
    It could destroy an LED, but I have no idea what he's talking about in limiting current in ever circuit or destroying an LCD. There's no need to limit current to these since they're 5v devices.
    I thought what I'd do was I'd pretend I was one of those deaf-mutes.

  9. #9
    rostifa Newbie
    Join Date
    Mar 2006
    Posts
    4

    Default

    thanks guys, i really appriciate the advice. Gotta take all you can get when you're starting i guess aye.

    I solved the oscillator problem but changing the caps on the crystal. Then I even got the LCD running using a mates PIC16F877A chip but it still would not run when the same code was used on my PIC16F877 version of the chip. I dont see why this is as there are no real differences in the PIC pin wise. Does anybody know what the differences are between these two and why i am getting these strange problems?

  10. #10
    rockin_rick Newbie
    Join Date
    Mar 2006
    Location
    IL, USA
    Posts
    33

    Default

    These chips have different programming 'methods', are you changing the settings in whatever programmer software you are using (and/or the device directives in the program before reassembling)?

    Rick

  11. #11
    Super Moderator Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent Nigel Goodwin Excellent
    Join Date
    Nov 2003
    Location
    Derbyshire, UK
    Posts
    29,794

    Default

    Are you also making sure the config fuses are set correctly?, the 877 and 877A use different values.
    PIC programmer software, and PIC Tutorials at:
    http://www.winpicprog.co.uk

+ Reply to Thread

Tags for this Thread