Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

A Real Newbie...

Status
Not open for further replies.

Garry2005

New Member
Hi All:

I'm doing a project that looks like only a microcontroller will be able to handle efficiently. Problem is...while I'm an older dude who's pretty well tech-savvy, I'm brand new to the world of microcontrollers and don't have a clue where to start. About the project: I thought it was original, but come to find out, LOTS of folks have been here before me. Anyway, it involves making a psuedo-cockpit for Flight Simulator that adds realism (switches, levers, buttons, knobs, etc). I have all the control functions needed to run F/S, and I've found all the scan-codes for keyboard emulation. Hacking a keyboard is an option, but there are some inherent problems with this approach: (1) Some of the functions are multi (and sequential) codes, for example: Setting the Altitude Bug is CTRL+SHIFT+Z. (2) I need to turn on (and leave on until the next toggle of the function) specific LED's. Autopilot, for example: I need to send a momentary "Z" from the keyboard, which enables A/P and sets (and holds) the A/P indicator lite, until I send another momentary "Z", which disables A/P and turns the light off.

Again, this could be done with hardware, but there are a lot of functions involved, which would require a mountain of hardware and wiring, and I'm thinking that a microcontroller would do most...if not all...of these functions a whole lot easier and more efficiently.

So...I've read the "Newbie" post, which seemed VERY helpful. I'll certainly browse through the tutorials and download the recommended files, too. But I'm a designer/developer of very technical equipment, I have no problem grasping new concepts, and I hate to start at the very bottom. I was hoping someone of the more experienced folks here could help get me started...maybe shortcut my way into this thing.

Thanks in advance for any responses...
Garry
 
Garry2005 said:
So...I've read the "Newbie" post, which seemed VERY helpful. I'll certainly browse through the tutorials and download the recommended files, too. But I'm a designer/developer of very technical equipment, I have no problem grasping new concepts, and I hate to start at the very bottom. I was hoping someone of the more experienced folks here could help get me started...maybe shortcut my way into this thing.

Thanks in advance for any responses...
Garry
I like to hear that! First tell us how many switches/ potentiometers you need to sense and how do you want to interface it with PC (I suppose you will use PC). :wink:
 
Jay.slovak said:
I like to hear that! First tell us how many switches/ potentiometers you need to sense

This would determine how many digital I/O lines and analogue conversion needed for your design which decides which PIC to be used.

Jay.slovak said:
and how do you want to interface it with PC (I suppose you will use PC). :wink:

Of course the best is to emulate an AT keyboard using several pins of the PIC so that no change is required in running F/S.
 
Response to this project...

Thanks millions for the help, gang! Okay, here's what I've decided to do, which should make it much easier on everyone. I'm gonna set up a page or two on my business website (www.jetcoder.com) and post the various functions there (the functions that are now controlled with the keyboard and mouse). As I said: I've got all the functions identified, I have the keyboard commands for those functions, and even the hex codes for each scan-code. In fact, I've even hacked my way into a multi-media keybaord and can replicate each key on the 8 x 18 matrix, with manual switch closure. So I guess the most logical approach would be to have the microcontroller talking to that keyboard encoder, right? Or maybe have the microcontroller send out the appropriate hex scan codes, and bypass the hacked keyboard? Now the problem is activating/deactivating specific indicator LED's for various functions with the microcontroller. Remember they have to stay on after activation (until deactivation), but obviously I cannot keep, say, the "G" switch closed during that period.

Anyway, I'll be posting those soon...I'm working on them as of this message. They'll be grouped logically, and each one will look something like: Select Airspeed Bug CTRL+SHIFT+R

When I have everything posted to the website and I'm sure my cross-referencing is correct, I'll stick the URL on here.

I'm including my email address on here: I checked the "Notify Me" box with the original post, but I didn't get notified; good thing I came over here and looked.

Many, many thanks, folks...

Garry
 
Re: Response to this project...

Garry2005 said:
Thanks millions for the help, gang! Okay, here's what I've decided to do, which should make it much easier on everyone. I'm gonna set up a page or two on my business website (www.jetcoder.com) and post the various functions there (the functions that are now controlled with the keyboard and mouse). As I said: I've got all the functions identified, I have the keyboard commands for those functions, and even the hex codes for each scan-code. In fact, I've even hacked my way into a multi-media keybaord and can replicate each key on the 8 x 18 matrix, with manual switch closure. So I guess the most logical approach would be to have the microcontroller talking to that keyboard encoder, right? Or maybe have the microcontroller send out the appropriate hex scan codes, and bypass the hacked keyboard? Now the problem is activating/deactivating specific indicator LED's for various functions with the microcontroller. Remember they have to stay on after activation (until deactivation), but obviously I cannot keep, say, the "G" switch closed during that period.

Anyway, I'll be posting those soon...I'm working on them as of this message. They'll be grouped logically, and each one will look something like: Select Airspeed Bug CTRL+SHIFT+R

When I have everything posted to the website and I'm sure my cross-referencing is correct, I'll stick the URL on here.

I'm including my email address on here: I checked the "Notify Me" box with the original post, but I didn't get notified; good thing I came over here and looked.

Many, many thanks, folks...

Garry
I think the best solution is to emulate make and brake codes by MCU (PIC preffered 8) ). This site should help you interfacing MCU to PS/2 port on your PC.
 
The PS2 keyboard has a clock line and a data line. If data appears on the data line in correct timing with the clock then the PC won't know whether it is a real keyboard or a fake.

The method of how to put the keyboard scan codes on the data line is clearly explained on this site.

The PS/2 Mouse/Keyboard Protocol (**broken link removed**)

Using a PIC one can easily implement the above protocol and send any keystoke to the PC.

But the more important question remains unanswered. Just how many switches/levers/knobs and lamps/LEDs would be in your cockpit?
 
Befuddled...

So then...the general opinion is that I use a PIC to send the keyboard scan-codes directly to the PC, versus talking to the keyboard encoder, and the switching would go straight into the PIC?

The logic of this makes sense, but I may have over-rated my abilities just a touch...or so.
>>The method of how to put the keyboard scan codes on the data line is clearly explained on this site. <<

I'm not completely lost, but I have to admit that it's not as clear to me as it is to you guys who are obviously pretty sharp with it. I could work my way through this, given time, but I was sorta hoping these PIC things would be a little more dummy-friendly. I use different interface stuff all the time, but this looks like I'd have to gain a whole lot of hardcore computer science knowledge before diving into it this way. Is that true, or am I just having a panic attack, here? Thus...do I need to bother creating and posting the control functions I mentioned before? I'm fairly convinced that a PIC is the way to go with this, but if it's that far over my head...or something that's gonna have me back in a classroom for a year...then there's no point in wasting everyone's time. As I said, I can do it by clobbering my hacked keyboard encoder with switches, and using discrete hardware for the LED's, but that's old technology, and fiddling with the multi-code functions will be clumsy at best. However, if these PIC's are as complex as they seem to be...difficult and time-consuming to learn...then I may have to re-think the PIC approach.

Comments, anyone??

Garry
(garry@jetcoder.com)
 
Gary i went to your site but did not see where the section was that described what switches knobs ect that you wanted to use..
 
Flt-Sim Project...

Okay, WilliB.

I haven't posted the "functions-list" to the website yet. After browsing a little deeper into PIC's, I wasn't sure if I had gotten in over my head, and I didn't want to waste everyone's time on here if it seemed I wouldn't be able to handle it that way. However, if you guys still think I can put this together with PIC's, I'll go ahead and finish up the list and post it to the website, then put the URL on here. Just for the heck of it, I'll also show the pinout/connectivity I had planned to use with the hacked keyboard encoder. If we don't use it, then we don't, but at least it'll be there for consideration.

Thanks again...
Garry
 
Flight Simulator...

(WilliB:) I haven't drafted up a physical layout yet, but it'll be different than any I've seen so far, because mine will be multi-aircraft capable. Meaning, you'll be able to fly any aircraft in the MS inventory from the "cockpit". I'll post the layout on here ...or on my business website...when I do it.)

Okay, gents; the functions/commands listing is done and posted onto my website (www.jetcoder.com/fltsim.html).

Garry
(garry@jetcoder.com)
 
Flight Sim...

WilliB says: >>looks do-able.. <<

Well, where and how would I start, WilliB? As my original post implied, I'm as "newbie" as it can get with PIC's. I don't even know which one (or ones) would be best suited for this, how they intrerface to the PC (or keyboard controller), how many inputs the various ones have, how many PIC's I'd need...would I need several for this project? If so, do they connect in parallel somehow?. Do the inputs employ key-bounce protection? What about the business where I'll have certain toggle switches that go on and stay on? Do the switches provide Vcc to the PIC, or ground, or is it a simple switch closure? How do PIC's work, basically: Is there a PC-resident development program where you create the PIC program and download it to the PIC? Which leaves me asking: Does the chip have memory for the program, or does a PIC require seperate memory? Would I get just a PIC chip and build around it, or is it a board with all the necessary stuff to make it work?

Clearly, I have only questions, here. I'd probably be able to grasp it quickly if I had a process running in front of me, but I may have been right before...I think starting from scratch with PIC's may be over my head.

Let me throw this out for giggles, and I may be stepping over a line with forum rules. If so, I'll take my whipping gracefully, and I'll apologize. But...Is there any chance that you (or maybe others) would have any interest in compiling the basics of this thing, for compensation? Maybe sort of "get it started" and then hand it over? This is a play-project, and I can't afford to just "hire programmers at the going rate". But certainly I'd pay for any parts, and at least something for your time. Up and running, I'd need to know (at least the basics) how to access the code and change things. I'm sure I could handle that with ease, but I think that starting at the very bottom would wear my tired, old brain to shreds.

So, here we are. I think maybe I shouldn't run out and start buying up a flock of PIC chips just yet, but maybe you're interested in organizing the front-end of it, and pointing me in the right direction. Also, we gotta give thought to those LED panel indicators...I'm guessing that's probably gonna end up with discrete hardware (flip-flops and shift registers), but again, I don't know the capabilities of the PIC's.

Garry
 
As most keyboards are now USB, it would make sense to make a USB keyboard using a PIC. Microchip have done most of the ground work - see **broken link removed**

Mike.
 
i'll do it for the fun of it.. the 16f877A has lots of I/O
what i need to know , after i look at you site again , is how many switches and LEDs we are going to need..
 
Re: Flight Sim...

Hi Garry2005,

You have asked a lot of questions so I'll try my best to answer them for you.

Garry2005 said:
I don't even know which one (or ones) would be best suited for this,

The choice depends on how many I/Os you would need. The "bigger" the PIC, the more I/O pins they have.

Garry2005 said:
how they intrerface to the PC (or keyboard controller),

See image at bottom of this posting. You connect pins of the PIC to the PC PS2 keyboard socket, if the PIC mimic the keyboard correctly using software, the PC won't know it is not talking to a keyboard.

Garry2005 said:
how many inputs the various ones have, how many PIC's I'd need...would I need several for this project?

We don't know. You would know how many I/Os needed so we asked the question earlier of how many switches and LEDs you required.

Incidentally, the same question has been asked three times already. First by Jay, then myself and lastly by WilliB. You need to think about it and give an answer. Not a 100% exact one but a ballpark figure with some reserves would be nice.

Garry2005 said:
If so, do they connect in parallel somehow?.

Yes, sort of but using different methods.

Garry2005 said:
Do the inputs employ key-bounce protection? What about the business where I'll have certain toggle switches that go on and stay on?

No problem, software can debounce the switch. With software, a momentary switch can also look like a toggle sw too.

Garry2005 said:
Do the switches provide Vcc to the PIC, or ground, or is it a simple switch closure?

Can be either, depends on how you wrote the software. You can even have the switches in matrix connections to simplify PIC connections and have a lot of switches.

Garry2005 said:
How do PIC's work, basically:

It has CPU, timers, I/O ports, ROM and RAM and oscillator, maybe more depends on different PICs. So its like a miniature computer already. Someof the PICs are one-time proprammable and others can be reprogrammed many times as they use EEPROM/FLASH to store the program codes.

Garry2005 said:
Is there a PC-resident development program where you create the PIC program

Yes, from Microchip the manufacturer, free of charge.

Garry2005 said:
and download it to the PIC?

You'll need a hardware programmer to do that. Ranging from simple several components serial design to designs that sits between PIC and a parallel printer port. There are dozens of design on the web which can be easily built. Ready built one are available for sale which comes with the associate software to handle the programmer. Web hardware designs often work with the free & excellent software like the one by our forum moderator Nigel Goodwin.

Garry2005 said:
Which leaves me asking: Does the chip have memory for the program, or does a PIC require seperate memory?

It doesn't need extra memory in most cases. The PIC has very efficient(RISC) code structure, most of the time the program would fit into its internal memory and you have many choices on the memory size within the same series of PIC. This is also the big incentive to use a PIC in the first place. If one has a program that needs 64K or more, then maybe there are other choices.

Garry2005 said:
Would I get just a PIC chip and build around it, or is it a board with all the necessary stuff to make it work?

As an DIP chip, with 18-pins, 28-pins or 40-pins or in other form of packaging.
 

Attachments

  • simkey.gif
    simkey.gif
    5.1 KB · Views: 265
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top