Connect with us

Circuit project - HELP - LED display, solenoid, Pic18F452

Discussion in 'Microcontrollers, Programming and IoT' started by r1ley, Mar 25, 2013.

Scroll to continue with content
  1. r1ley

    r1ley

    6
    0
    Mar 25, 2013
    Hey all,

    I'm hoping someone can help me with a few things.

    As a project I'm trying to create a braille reader as a project for school.

    I'm using a PIC 18F452 chip . which will be connected to a PS/2 keyboard.
    The chip will take the hex codes from the keyboard, and output the corresponding value to 6 electric solenoids or servo motors which will push the corresponding pins up or down.

    Pyroelectro has a tutorial on how to connect a ps/2 keyboard to a 7-segment LED display
    http://www.pyroelectro.com/tutorials/ps2_keyboard_interface/index.html

    I just purchased a 16-segment display in order to be able to view all the letters that the 7-segment cannot, like the letter K, or V or W and so on .

    according to their code, they use the RD outputs only
    pic: http://www.pyroelectro.com/tutorials/ps2_keyboard_interface/img/schematic.png

    how can I configure the code to use RB and RC as well? As I'll need to use 9 more outputs.

    Also, how can I change the code so it will drive the 6 different solenoids?
    These are the solenoids I just purchased:
    https://www.jameco.com/webapp/wcs/stores/servlet/Product_10001_10001_1919385_-1

    Any help would be great
    Thanks
     
  2. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    Do you know C and have the compiler he used? If so tweaking the program is not hard, and if you don't know C it's a good study for a school project as these tweaks will get your feet wet but are not overly complicated...

    2nd the last page of the article links to a forum where the author will likely answer questions, and you can't get any better assistance on his project than from him...
     
  3. r1ley

    r1ley

    6
    0
    Mar 25, 2013
    Hey, thanks for the reply
    I know a bit about C, just not too good at using it for micro controller programming.

    How would I initiate the other outputs?
    He starts using RD as the outputs for the 7 segment .. is there a way I can start form RA?

    In the code he states that the 7 segment LED is reverse polarity, so I'm assuming the 16-segment is the same?

    in the code it says
    PORTD = 0x0 ^ 0xFF

    can I change port C to be the same? as well as B?
     
  4. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    PORTD = 0 ^ 0xFF

    Means the the programmer did not know what he was doing.

    Bob
     
  5. r1ley

    r1ley

    6
    0
    Mar 25, 2013
    Okay. So someone who would know what they're doing.. How would they go about doing it?
    Plz and thank you.
     
  6. BobK

    BobK

    7,682
    1,688
    Jan 5, 2010
    PORTD = 0xFF;

    Bob
     
  7. r1ley

    r1ley

    6
    0
    Mar 25, 2013
    Hey bob
    sorry to sound like such a noob

    but if I want to use RA and RB as well, how can I modify the program to do so?

    this code is for a 7 segment display, I'm trying to use it for a 16-segment display.

    Also after initiating the ports, how can I configure the code to output those bits?

    Thanks in advance
     
  8. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    R1ley since this is a school project, instead of us giving you the answer, maybe you would like to take a shot at it yourself?

    I personally struggle with C, I can get by with it but it annoys me and like any language the compiler you use makes all the difference on how 'proper' you have to be with the code to get it to work...

    But, with that said when you see a line like...

    PORTD = 0xFF;

    First do you know what that does? And second if you wanted to do the same to a different port what do you suspect the change would be, void of the fact that certainly micros have reserved pins that don't always behave universally as a digital I/O...

    Make the change to the code, and try compiling it, did it compile? Now load it on a chip does it do what you expected it to do? This is by far the superior way to learn vs someone handing you the answer...
     
  9. r1ley

    r1ley

    6
    0
    Mar 25, 2013

    Fair enough, completely understand what you're saying.
    I"m trying out the codes now.. thing is I'm stuck with my 7-segment display and the 16-segment is still in the mail :(
    I'll tinker with it when I get it.. was hoping to have a bit more set up before it arrived.
     
  10. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    Use regular LEDs for testing or simply shift the 7 segment over to the A or B port and test, you know it works on the D port...
     
  11. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,497
    2,839
    Jan 21, 2010
    Yeah, as a hint, look at the code. Wherever it says xxxxD and it appears to be referring to port D, change it to xxxxA.

    You need to look carefully at the microcontroller's port usage. Maybe some ports have pins that are input only or output only, or reserved for special purposes, or used for things like the clock, or perhaps have less than 8 pins...

    Once you're sure the other port will work in your case, change the code to refer to the alternate port.

    However, it's best if you go through the code and make sure you understand what it does and how it does it. If you don't you'll not really be learning much. Also, if you have a problem , you won't know what to do if you don't understand your code.
     
  12. r1ley

    r1ley

    6
    0
    Mar 25, 2013
    So here's where I'm stuck

    I can't seem to use this PIC chip. I've switched to the 16F877A.
    Similar pin orientation.
    However in this code he includes <capture.h>

    I can't seem to get the compiler to recognize this.

    I get an Error 141 - No such file or directory.

    I'm assuming because I'm using the FREE version of the Hi-Tech ANSI C compiler, the library is not included in it. And I don't have $500 to spend on a compiler.

    Is there any other library anyone knows of that I can include that will allow me to capture HEX codes via a PS/2 port from a keyboard?

    I'm really stuck on this part so any help would be great.
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-