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 / 8529
8528  |  8530
Subject: 
Re: Reset & running Main ( )
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Mon, 31 Dec 2001 06:15:46 GMT
Viewed: 
1706 times
  
Fred,

Man, do you ever sleep?  I hope you know how much your support is appreciated.

Here is a copy of my jrm1.c file.  Just a reminder, if I type " main() " in
the IC window on my PC, this file executes flawlessly.

Thanks,
John



/* filename: jrm1.c    John R. McDaniel */

void main () {

while (1){ /*do this loop endlessly*/


printf("Test Motors !!\n");   /*print 'Test Motors !!' on LCD*/

ao(); /*both motor off for 2 seconds*/
sleep (2.0); /*delay start so can unplug cable*/

/*go forward*/
printf("Forward\n"); /*print 'Forward' on LCD*/
fd (0); /*left motor forward*/
fd (2); /*right motor forward*/
sleep (3.0); /*do this for 3 seconds*/
alloff(); /*let motors coast to stop*/
sleep (1.0);

/*turn right*/
printf("Right\n"); /*print 'Right' on LCD*/
fd (0); /*left motor forward*/
bk (2); /*right motor backwards*/
sleep (2.0); /*do this for 2 seconds*/
alloff(); /*let motors coast to stop*/
sleep (1.0);

/*turn left*/
printf("Left\n"); /*print 'Left' on LCD*/
bk (0); /*left motor backwards*/
fd (2); /*right motor forward*/
sleep (2.0); /*do this for 2 seconds*/
alloff(); /*let motors coast to stop*/
sleep (1.0);

/*go backward*/
printf("Back\n"); /*print 'Back' on LCD*/
bk (0); /*left motor backwards*/
bk (2); /*right motor backwards*/
sleep (3.0); /*do this for 3 seconds*/


alloff(); /*all motors off, rest until next loop*/
printf("Loop Done\n"); /*print 'Loop Done' on LCD*/

sleep (5.0); /*pause before doing loop again*/

}
}

/* end */














In lugnet.robotics.handyboard, Fred G. Martin writes:
Well, at this point I'm out of ideas.  Would you please copy and paste
your jrm1.c file into an email message and send that to the list.
(LUGNET strips attachments, so it has to be plain text body of the msg.)

thanks,
Fred

On Monday, December 31, 2001, at 12:12 AM, John McDaniel wrote:

Fred,

I double-checked, and my " main() " program (filename: jrm1.c) is all
lower
case letters.  I confirmed case sensitivity by trying to call the "
main() "
file (filename: jrm1.c) which has been downloaded to the HB by typing "
Main() " on the PC.  I get a "  Function Main() undefined  " message in
the
IC window.

Typing " main() " on the PC causes the downloaded file (filename:
jrm1.c) to
run.  Resetting the HB does not cause jrm1.c to run.

To further confirm, I modified my program renaming the main function as
" Main " and then downloaded this file (filename: jrm2.c).... after
unloading jrm1.c.  Typing " Main() " causes the HB to run jrm2.c.
Typing "
main() " causes a " Function main undefined  " message to be displayed.
Resetting the HB does not cause jrm2.c to run.

Your perserverence is much appreciated.  Suggestions?

Regards,

John

___________________________________

In lugnet.robotics.handyboard, Fred G. Martin writes:
I wonder if it's because you've capitalized "Main()".  C is case
sensitive so main != Main.

try it making your main program lower case and see if that works.

Fred

On Sunday, December 30, 2001, at 01:36 PM, john McDaniel wrote:

Fred,

Thanks for the very prompt response.  Your responses to queries on
this
board continue to provide very useful insights.

With respect to your response #1, it is helpful to know that "list
files"
does not actually read the Handy Board and is therefore not a
definitive
indication of what is resident in Handy Board RAM.

Your response #2 would make a useful footnote to that section of the
technical reference and your book "Robotic Explorations" which
discusses the
reset vector.


You are correct. If I:

a. download a program containing a function named main(),
b. turn the handy board off and unplug it from the desktop PC,
c. turn the HB on,

the HB does NOT run main().  Upon turning the HB back on, it beeps
once
and
the LCD displays "IC v3.1 Handy Board 1.2" and the heartbeat.

As noted in my #5 below, if I leave IC running (so it will not
"forget"
what
has been downloaded (your response #1)) while executing steps a thru
c, I
can plug the serial cable back in, type " main() " and the Handy Board
will
run the downloaded " main() " program.

Thanks again for the help, Fred.


Regards,

John









In lugnet.robotics.handyboard, Fred G. Martin writes:
John, a couple things.

1.  when you quit and restart IC, it forgets what programs you may
have
loaded into the HB.  so that explains your #4 case below.

2.  IC has its own way of storing vectors for user code like your
main()
program, so you should not expect the hardware reset vector to change
when you load your IC user code.  so this explains your case #8.

what should work is the following:

a.  you download a program containing a function named main().
b.  turn the handy board off and unplug it from the desktop machine.
c.  turn the HB on, and it should run main().

does this not work?

fred



On Saturday, December 29, 2001, at 05:29 PM, John McDaniel wrote:

Dear "Group",

....what are we?  Lugnetters? Lugheads? Lugnuts?

Regardless, I need some guidance on getting my Handyboard to run a
downloaded Main( ) program upon powerup/reset.  Here are some facts
regarding my problem.

1. The Handyboard downloads the Pcode properly and the LCD displays
the
"IC
v3.1 Handy Board 1.2" message plus a pulsing heartbeat.

2. I can execute the various IC commands from my PC.... beep( ),
read
memory
locations with peek( ), turn motors on and off, read Knob, etc.

3. I can download a Main( ) program (filename jrm1.c) to the Handy
Board and
them make it run by typing " main ( )" on the PC.  I can unplug the
serial
cable and the Handy Board will continue to execute the " main( )"
program
sequences.

4. I leave the serial cable plugged into the HB and I do not turn
off
the HB
power switch.  If I quit IC (on the PC) and restart, then type "
list
files"(after the IC initialization process with the HB),  IC does
not
list
my main( ) program (filename jrm1.c).  If I try to run my main( )
program
(filename jrm1.c), IC displays "Function main undefined".

5. I unplug the serial cable from the HB, turn off the HB power
switch,
and
leave IC running on the PC.  Leave HB power off for 10 minutes.
Plug
serial
cable back into the HB and turn on the HB power switch.  Instead of
executing my " main( )" program (filename jrm1.c), the LCD displays
the
"IC
v3.1 Handy Board 1.2" message with heartbeat.  Now, type " main( )"
on
the
PC and my "main( )" program (filename jrm1.c) runs properly.

6.  I have oscilloscoped the 62256 RAM chip's MEM-PWR pin and see no
interruption of power when the HB power switch is turned off and on.
Operation of the DS1233 (and subsequent 74HC132 gates) seems correct
at
the
62256's "/E" pin (20).

7.  The red LED11 PWR LED (led 11) "winks" upon reset and the the
oscilloscope shows a normal reset waveform at pin 17 on the 68HC11.
Reset
also seems to correctly influence the "/E" pin (20) on the 62256.

8.  Before downloading any " main( )" program to the HB, using IC, I
peek
(49150) [$BFEE] and (49151) [$BFFF] and see a reset vector of $C500
which, I
believe, is the location of IC on the HB.

If I download a " main( )" program to the HB and then peek (49150)
and
peek
(49151) the reset vector has not changed.


I'm about at wit's end trying to get my HB to run a " main( )"
program
upon
powerup reset.  Can anyone suggest additonal tests I might perform
or
provide some insight on what I am overlooking/misunderstanding?

Any assistance is greatly appreciated.

Going crazy in Columbus......John






Message has 2 Replies:
  Re: Reset & running Main ( )
 
Try taking the white space out from between the "main" and the "()" -Dan (...) (22 years ago, 1-Jan-02, to lugnet.robotics.handyboard)
  Re: Reset & running Main ( )
 
John, I just loaded up your version of the code you posted, It worked fine on reset. I took out the white space just to see, and it worked fine too! I would say that your memory is bad or the lm2931 -5 is bad. Something is causing total reset (...) (22 years ago, 1-Jan-02, to lugnet.robotics.handyboard)

Message is in Reply To:
  Re: Reset & running Main ( )
 
Well, at this point I'm out of ideas. Would you please copy and paste your jrm1.c file into an email message and send that to the list. (LUGNET strips attachments, so it has to be plain text body of the msg.) thanks, Fred (...) (22 years ago, 31-Dec-01, to lugnet.robotics.handyboard)

14 Messages in This Thread:



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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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