Go to Post By affiliating yourself with a team, you are representing them at all times, as you are a member and part of that team. - Chris is me [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 12-03-2007, 00:29
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Interesting thought....

Not that I actually intend to try this, if it is possible, except perhaps for educational purposes, but would it be theoretically possible to generate your own serial communation/TTL port, through a Digital IO. Setup a timer and interrupt to get the right baud rate, and just set a digital output to either 0 or 1 at each interrupt, so it would operate like a TX signal. TTL uses the 0V to 5V logic, correct? If the signal pin doesn't provide enough voltage, maybe just let it trigger a transistor, which is connected to 5V.

Mostly, I'm asking this to confirm my understanding of how serial communication actually works, and I'm guessing I'm still a little bit off. It seems a tad too simple, the way I explained it. And if I am understanding things correctly, my next guess is that the interrupts will be triggering too often, slowing down the rest of the code. Am I on track at all?
__________________
Code:
void function(void)
 {
  function();
 }
  #2   Spotlight this post!  
Unread 12-03-2007, 00:51
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,827
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: Interesting thought....

You are 100% correct that it would be possible, and I am sure some of the serious codeheads will expand upon the most efficient way of doing it... although it sounds like you are heading in the correct direction.

In fact I have done something very similar using the PIC 16F627 and 16F84 series of chips using the "SEROUT" and "SERIN" commands of PIC Basic Pro from MELABS.

While it is convenient to use the commands in PIC Basic Pro, all they do is... as you suggest... turn digital I/O pins on and off.

More advanced PICs, such as the 18Fwhatevers in the RC actually have serial ports built in to them that handle a lot of the timing and I/O at a chip level, rather than having to run your own code... but those work only on certain pins. It doesn't mean that you couldn't program your own serial port onto any other series of pins. In fact USB and ethernet connections have both been programmed into PIC microcontrollers as well... they are just another rapid series of one's and zeros... albeit with a somewhat more sophisticated logic and timing than RS232.

Don't feel obliged to work only with the RC... take a look at some of the different PICs available either as free samples from Microchip, or through Digikey/other on-line vendors. It is amazing how much computing power you can get for just a couple of bucks!

Jason
  #3   Spotlight this post!  
Unread 12-03-2007, 12:05
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,721
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Interesting thought....

It's a good thought. Any regular RC digital pins and one of the internal timers are all you need.
I found it to be an insightful exercise and did an example using an LCD as an output device.

It's a good excuse to expand to other chips and external processors too as Jason suggests.

P.S.
Just remembered Kevin Watson mentioned he had an example of serial communication such as this as well. I found it on his website with the 2005 code examples.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 12-03-2007 at 13:39.
  #4   Spotlight this post!  
Unread 12-03-2007, 17:05
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: Interesting thought....

Well, if it really is that easy, maybe I will try it. After all, there aren't many other uses for a Digital Output. In fact, I can't really think of one at all, unless you count LED feedback, which can't be done directly.
__________________
Code:
void function(void)
 {
  function();
 }
  #5   Spotlight this post!  
Unread 12-03-2007, 18:28
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,827
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: Interesting thought....

While FIRST limits the uses to which a digital output can be put simply to ensure that motors and relays are all hooked up and running in a safe, controlled and easily inspected manner, there is no reason that a digital output can't be used to drive a speed controller, or any number of other uses. We use the digital outputs on a PIC 16f627a to drive an H-bridge chip that runs the mini-sumo robots we build in our engineering class.

In FRC robots, however, the main uses for these pins are as digital inputs, particularly as interupts, limit switches, etc. When you examine the data sheet of the PIC chip that drives the RC in more detail you will appreciate just how many different things the different pins on the PICs can be used for, and how elegantly Microchip has structured their design.

While I agree with you that under FIRST rules there are restrictions on the use of digital outputs (and with all the PWMs and Relay outputs available, it's usually not a big deal) but in other applications the digital outputs are quite useful.

Jason
  #6   Spotlight this post!  
Unread 12-03-2007, 20:38
Jake M Jake M is offline
void* Jake;
FRC #1178 (DURT)
Team Role: Programmer
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Missouri
Posts: 118
Jake M has a spectacular aura aboutJake M has a spectacular aura about
Re: Interesting thought....

Excellent point. Our team really has never ventured too far beyond FIRST, thus I've never been given much reason to think that way. I've been trying to lately though, and hopefully I can spread this mindset to the rest of the team.
__________________
Code:
void function(void)
 {
  function();
 }
  #7   Spotlight this post!  
Unread 12-03-2007, 22:25
meatmanek meatmanek is offline
Programmer/physicist/mathematician
FRC #0868 (TechHounds)
Team Role: Programmer
 
Join Date: Mar 2004
Rookie Year: 2004
Location: Carmel, Indiana
Posts: 142
meatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to beholdmeatmanek is a splendid one to behold
Re: Interesting thought....

It would be neat to see some code written and published that would provide a port3 serial port based on one or two digital IO pins.
Maybe that could be my project for the summer.
__________________
Real programmers use vim.
  #8   Spotlight this post!  
Unread 12-03-2007, 22:39
Cuog's Avatar
Cuog Cuog is offline
Registered Linux User: 390661
AKA: Alex
FRC #0422
Team Role: Mentor
 
Join Date: Nov 2005
Rookie Year: 2004
Location: Richmond, Virginia
Posts: 852
Cuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond reputeCuog has a reputation beyond repute
Send a message via AIM to Cuog
Re: Interesting thought....

I'm sure that if you look around many hobbyist robotics sites for programming you can probably find some sort of code that will handle serial communication to learn from then its just a matter of take that and write your own.
__________________
KK4KQO
http://voltair.us
Too many projects, too little time.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Interesting thought Lisa Perez Chit-Chat 3 05-07-2004 23:38
Random Thought... Marygrace Chit-Chat 12 14-05-2003 15:50
Random Thought Ricky Q. Chit-Chat 32 25-10-2002 13:26
A New Thought... Nate Smith General Forum 5 28-09-2001 01:16
Thought on Qualification Matt Leese General Forum 0 24-09-2001 23:20


All times are GMT -5. The time now is 09:33.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi