To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 1669
1668  |  1670
Subject: 
Re: Handy Board serial routines
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Fri, 14 Mar 1997 05:38:20 GMT
Original-From: 
Xavier Chabot <chabot@rpi=AvoidSpam=.edu>
Viewed: 
4101 times
  
> 
>        Greetings,
> 
>        The serial port could be used after downloading the program
>        code into memory for other purposes (such as controlling the
>        mini-ssc board). However, I have not found any reference to
>        RS-232C port IC commands, so one would have to build custom
>        assembly code to access the serial port. Of course, there
>        may be some firmware impediment to that...( handyboard
>        experienced users, please)?
> 
>        Marco A.A. de Oliveira                  assfalk@eece.unm.edu
>        ------------------------------------------------------------
>        EE PhD Candidate                        UNM/NASA ACE Center
>        ----------------------------------------http://ace.unm.edu--


/* ----------------- SENDING AND RECEIVING THROUGH THE SERIAL LINE -----------
the IC program must be stopped in order for this to work !
the  code is from the handybaord FAQ by  Fred Martin or ?? Randy Sargent ??
added by Xavier Chabot, 3-3-97: serial_getchar2()

receiving from the serial port:
disable_pcode_serial():  prevents the onboard pcode to catch the incoming
serial data
reenable_pcode_serial(void): reestablishes connection
serial_getchar(): returns a character send from the computer

sending to the serial port:
blocking: serial_getchar(): waits until a character is sent
the character is return as int
non blocking: serial_getchar2(&val) checks if there is a character to be
read. the character is written at the address val. returns 0 if there is
something, -1 if there is nothing

*/


/* --------------- READ from serial port  ------------------- */
void disable_pcode_serial(void)
{
poke(0x3c,1);
}

void reenable_pcode_serial(void)
{
poke(0x3c,0);
}

/*  blocking read */
int serial_getchar()
{
while(!(peek(0x102e) & 0x20)); /* wait UART */
return peek(0x102f);
}

/* test UART and get char but no wait */
int serial_getchar2(int *val)
{
if (peek(0x102e) & 0x20) /*  UART ready? */
{
  *val = peek(0x102f);
  return 0;
}
return -1;
}

/* --------------------- WRITE to serial port --------------------------*/
/* writes a character to the serial port - blocks until free */
void serial_putchar(int c)
{
while (!(peek(0x102e) & 0x80) ); /* wait UART */
poke(0x102f, c);
}
Xavier Chabot / Assistant Professor of Music / Department of the Arts
iEAR Studios - DCC 135 / Rensselaer Polytechnic Institute / Troy, NY 12180
Phone: (518) 276-4032 Fax: (518) 276-4780 http://www.rpi.edu/dept/iear/~chabot



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR