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 / 3670
3669  |  3671
Subject: 
Serial Communication: HB -> Win95
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Tue, 21 Apr 1998 03:11:14 GMT
Original-From: 
Douglas Blank <dblank@comp.SPAMCAKEuark.edu>
Viewed: 
693 times
  
I am using the serial_putchar() and serial_getchar() communication routines
on the HandyBoard, and everything is working fine from the PC to the HB.
However, I am having trouble getting the HB to send data back to the PC.

Here is main() on the HB:

void main(void) {
char c = '!';
int cnt = 1;
disable_pcode_serial();
while (cnt <= 10) {
c = serial_getchar();
printf("[%d]=%c ", cnt, c, c);
serial_putchar('!');
cnt++;
}
reenable_pcode_serial();
printf("   HB Mode!");
}

The serial line is set correctly, but I haven't been able to get anything
back to the host.

I have included the code that I am compiling under VC++4.0 and Win95 below.
If you have any suggestions of what I can do (other than trying to get
Linux running on my laptop), I'd love to hear them.

Thanks!

-Doug Blank

/* Visual C++ Host Code to talk to HandyBoard         */
/* call like: serial.exe 1                            */
/*            to send the character "1" to the HB     */

#include <stdlib.h>
#include <stdio.h>

void myputc(char c, FILE *p) {
  int result = fputc(c, p);
  printf("Put '%c' to HB; result was = %d\n", c, result);
}

void main(int argc, char *argv[])
{
  FILE *port;
  char c = -1;
  int x;
  port = fopen("COM1:", "wr");
  if (port == NULL) {
    printf("Error establishing serial connection.\n");
    exit(1);
  }
  else
    printf("Serial connection established...\n");

  myputc(argv[1][0], port); // works, HB receives it.

  /* This doesn't work!
  while (c < 0) {
c = fgetc(port);
  }
  printf("Got %c (%d) as a return value\n", c, c);
  */
  fclose(port);
}

=====================================================================
dblank@comp.uark.edu            Douglas Blank, University of Arkansas
Assistant Professor                                  Computer Science
==================== http://www.uark.edu/~dblank ====================



Message has 1 Reply:
  Re: Serial Communication: HB -> Win95
 
To answer my own question, at least partially, here is a Win95 Host program to communicate (single bytes) with the HandyBoard over a serial line: /* Win95 Visual C++ Host Code to talk to HandyBoard */ #include <conio.h> // _outp, _inp #include (...) (26 years ago, 22-Apr-98, to lugnet.robotics.handyboard)

2 Messages in This Thread:

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

Custom Search

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