BasicMicro - Forums

www.basicmicro.com
It is currently Mon May 21, 2012 12:22 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Major problem in the Nano 18 manual! Regarding RS-232 = TTL
PostPosted: Fri Sep 17, 2010 6:08 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 9:06 am
Posts: 120
Location: Wisconsin USA
I couldn't figure out why i couldn't program my new nano18..

You guys at Bmicro, told us how to make an RS-232 adapter in the manual.. but left out the fact it requires TTL!

I was trying to program it directly from the RS-232
"Whoops!"

Probably should have mentioned it a few times in the manual regarding the programming connector.
(Programming signals are TTL, not direct RS-232)

On the bright side, no harm done. On the down side, i can't use my common connector anymore. I'll need to make a RS-232 to TTL inline converter.

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Major problem in the Nano 18 manual! Regarding RS-232 =
PostPosted: Fri Sep 17, 2010 7:02 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
I checked the forum manual and it only shows a translator circuit with a MAX232A IC to handle the plus/negative voltages from the PC or other source of RS232.
Do you mean a data sheet? Or the manual in Studio's Help menu? What did you use for a guide?
Take care.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Major problem in the Nano 18 manual! Regarding RS-232 =
PostPosted: Fri Sep 17, 2010 7:59 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 9:06 am
Posts: 120
Location: Wisconsin USA
The Datasheet.


What does the AUSART on P2 and P5 of the nano 18 mean?
What can i do with it?

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Major problem in the Nano 18 manual! Regarding RS-232 =
PostPosted: Fri Sep 17, 2010 8:14 pm 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
And I quote from the Nano18 data sheet:
Quote:
A RS232 or USB to Serial circuit is required.

Ahem.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Major problem in the Nano 18 manual! Regarding RS-232 =
PostPosted: Fri Sep 17, 2010 8:28 pm 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 9:06 am
Posts: 120
Location: Wisconsin USA
kenjj wrote:
And I quote from the Nano18 data sheet:
Quote:
A RS232 or USB to Serial circuit is required.

Ahem.


Then it's ignorance on my part.
I've always known RS-232 as being the PC com port.
And TTL being it's own type of serial connection.

So when i read RS-232, i automatically assumed it meant the com port of the PC.


Edit: dont want to make a new thread.
I can send < or > to the bot, but how do i make it recognize in the if/else/then bit?
My gameboy advance SP's terminal has limited outputs.

< left
>right
^up
v down (lowercase V_
B
A
L (Left trigger)
R
S (start
s (select, lowercase S)

I want to bind to all of these, but i don't yet know how ti make it read strings. .

Code:
pause 500

serout p5,i9600,["Getting Started"]
pause 100
cbot var byte
cbot2 var word

main


serin P2,i9600,[str cbot]


;cbot2 = 2* cbot

;serout p5,i9600,[dec4 cbot2]
;pause 200
;goto main

if (cbot = "<") then
serout p5, i9600,["Hello"]

goto main
elseif (cbot = ">")
serout p5, i9600,["Goodbye"]

goto main
endif
goto main


BTW the botboard nano 18 is doing very well.
Needs a power switch though, will add that later.
Gotta goto work now.

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
 Post subject: Re: Major problem in the Nano 18 manual! Regarding RS-232 =
PostPosted: Sat Sep 18, 2010 12:40 am 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
Hello, Fallentine.
This code works:
Code:
pause 500

serout s_out, i9600,[0, 7, "Getting Started", 13, 13]
pause 100
cbot var byte
cbot2 var word

main
serin s_in, i9600,[cbot]

if (cbot = "<") then
serout s_out, i9600,["Go Left", 13]

elseif (cbot = ">")
serout s_out, i9600,["Go Right", 13]

elseif (cbot = "X") OR (cbot = "x")
serout s_out, i9600,["STOP!", 13]

elseif (cbot = "^")
serout s_out, i9600,["Go Forward", 13]

elseif (cbot = "r") OR (cbot = "R")
serout s_out, i9600,["Go Reverse", 13]

endif
goto main

You don't want the "str" in your input, it stops proper operation. I got rid of the "goto main"s in your IF-THEN-ENDIF statements. If you don't use the "endif", ie, if the "goto main" breaks the routine before the "endif", then the stack gets filled and wierd <!> happens, maybe even a reset. :o
So, as you enter characters, a legal character produces its assigned string and does a carriage return. Any other character gets printed to the screen because I'm using the programming port and we have the "loopback" because both the TxD and RxD are sent to a single pin.
As you can see, using "OR" allows you to specify both the uppercase and lowercase of the same letter. Or two different entries if needed.

As for P2 and P5, these are the recieve and transmit pins, respectively, of the builtin hardware USART. These use the HSERxxx commands to operate. These have sizable character buffers. These have interrupts available, but I can't say if these are supported in the BASIC natively, you'll probably have to use the ISRASM function. These are largely set and forget. So, send a character to be transmitted, then jump immediately to another task while the hardware deals with transmitting the character out. Same for the receiver, just do other things 'til the character is fully received. If you have serial streams to handle and a lot of work going on in the background that can't be easily dropped to handle bitbang serial traffic, then the USART is definitely the way to go.

Strange thing about my PC: My Studio terminals don't start reliably. I usually start with Terminal1 at the screen's bottom. Sometimes I'm forced to go to Terminal2 to see things run. Then I'll change code and 1 may work, but maybe not. One time I was forced to use Terminal3 because -1 and -2 wouldn't start?! :|

So let me know how this works for you.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Major problem in the Nano 18 manual! Regarding RS-232 =
PostPosted: Sat Sep 18, 2010 8:15 am 
Offline
Master
User avatar

Joined: Tue Jul 07, 2009 9:06 am
Posts: 120
Location: Wisconsin USA
I haven't been able to figure out the hserial in the nano 18 yet, it sees errors in the sethserial commands.

I think the problem was with my terminal program, it's not receiving information back.
i linked a second terminal to the same TX pins on the BBnano, and the second terminal (hardwired) seems to receive the replies just fine, where as the bluetooth on the main terminal does not.

Except with studios terminal, it receives no problem.. So it's something about how my main terminal program sends/receives data, or accesses the ports.

Using this terminal program http://sites.google.com/site/terminalbpp/

Seems a bit... "wonky" with bluetooth adapters.

_________________
Image
Basic Micro Blog
Universal Robot Controller


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO