Searching \ for '[PIC]: array sizes, port interrupt' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ints.htm?key=interrupt
Search entire site for: 'array sizes, port interrupt'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: array sizes, port interrupt'
2001\03\18@114338 by J.A.YOUNG

flavicon
face
I am writing a program in Hitech PIC C-Lite (under MPLAB) for a PIC16F84. The
aim is to get a micromouse to the middle of a maze. The maze data is stored in
an array, which for a full size maze must be ~33*33.

At the moment I get errors if I use an array bigger than 7*5. Something about
words and BANK0- memory things. I saw something in the archive about
limitations on memory, but it didn't help. Do I need to use a number of PICs or
can I use a different method.

I also need to set up an interrrupt on a port, so that when the sensory data
changes, I can call a routine.

My C is fairly basic and my assembler is non-existent. Any help or ideas would
be great.

cheers,

john young
spam_OUTjay298TakeThisOuTspamsoton.ac.uk

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\03\18@145709 by Drew Vassallo

picon face
>an array, which for a full size maze must be ~33*33.

The '84 only has 68 bytes of RAM.  Do you need 33 x 33 bytes?

>At the moment I get errors if I use an array bigger than 7*5. Something
>about
>words and BANK0- memory things. I saw something in the archive about

7x5=35 bytes... you should be able to handle up to 68 bytes, as I mentioned,
but I would assume that you're using other RAM registers for your program,
aside from the maze data block.

>I also need to set up an interrrupt on a port, so that when the sensory
>data
>changes, I can call a routine.

You can use RB0 for interrupt on either a rising edge or falling edge.  It
should explain it all in the "Special Features of the CPU"... Note that you
don't want "Interrupt on Change" for port B pins 4-7.

8.9.1 INT INTERRUPT
External interrupt on RB0/INT pin is edge triggered:
either rising if INTEDG bit (OPTION_REG<6>) is set,
or falling, if INTEDG bit is clear. When a valid edge
appears on the RB0/INT pin, the INTF bit
(INTCON<1>) is set. This interrupt can be disabled by
clearing control bit INTE (INTCON<4>). Flag bit INTF
must be cleared in software via the interrupt service
routine before re-enabling this interrupt. The INT
interrupt can wake the processor from SLEEP
(Section 8.12) only if the INTE bit was set prior to going
into SLEEP. The status of the GIE bit decides whether
the processor branches to the interrupt vector
following wake-up.

Hope this helps,

--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\03\19@022832 by Roman Black

flavicon
face
Drew Vassallo wrote:
>
> >an array, which for a full size maze must be ~33*33.
>
> The '84 only has 68 bytes of RAM.  Do you need 33 x 33 bytes?


Hi, doesn't proper Micromouse rules specify standard
maze size of 16 x 16 squares? This was so you could use
two bytes to be a "row" and you only need 32 bytes total
for all 16x16 squares??

Even if this is a very big maze it would be 32x32,
so you can use 4 bytes per row. These competitions are
designed by uni computer professors and it seems unlikely
they would go for 33x33??? Just doesn't seem right. I
have an official micromouse rules sheet and it is 16x16
maze.:o)
-Roman

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\03\19@053208 by jay298

flavicon
face
Hi,thanks for the quick replies,

The maze is a standard micromouse 16*16 grid (=256), but
the algrorithm i'm using stores a grid potential, i.e. the
number of squares to be moved to get to the goal- this
takes up 16*16 squares, but in between these squares I
store the wall information, e.g:

|Wl=255 | Pot=2 | Wall=0 | Pot=1 | Wall=0 | Pot=0 |
|       |       |        |       |        |       |
---------------------------------------------------
|       |       |        |       |        |       |
|Unused | Wl=255| Unused | Wall=0| Unused | Wl=255|
|       |       |        |       |        |       |
---------------------------------------------------
|       |       |        |       |        |       |
|Wl=255 | Pot=3 | Wl=255 | Pot=2 | Wall=0 | Pot=1 |
|       |       |        |       |        |       |


I realise now this isn't terribly eficient in terms of
memory, but I didn't think of that when I chose to use it
(ages ago!).


I stored the data as integers, which means *2* bytes per
square= 2178 bytes for the whole maze!

What does it mean to store the data as _bits_? Is that like
NESW    > directions
1010    >gap or wall

I think that unless  I radically alter my algorithm or data
storage method, I will have to use a PIC with more memory
or EEPROM as suggested. Is EEPROM easy to use in a
existing program, or will it require lots of rehashing of
the program and new code ( I'm running out of time for my
project!)? Does anyone know of any good idiot's guides to
EEPROM on the web??

thanks,
----------------------
john
.....jay298KILLspamspam@spam@soton.ac.uk

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\03\19@081325 by Olin Lathrop

face picon face
> My C is fairly basic and my assembler is non-existent. Any help or ideas
would
> be great.

I think this is the first issue to address.  Until you understand the
language you are using and the processor running the code, you will continue
to bump into one inexplicable problem after another.  Spend the time now and
save a lot in the future.


********************************************************************
Olin Lathrop, embedded systems consultant in Littleton Massachusetts
(978) 742-9014, olinspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\03\19@091316 by Drew Vassallo

picon face
>I stored the data as integers, which means *2* bytes per
>square= 2178 bytes for the whole maze!
>
>What does it mean to store the data as _bits_? Is that like
>NESW    > directions
>1010    >gap or wall

I'd ask Roman about this, since he seems to know the Micromouse specs, but I
think you'd have an array of 16 x 16 bytes (32 bytes total) for a grid of
256 positions.  Every position would have either a "1" if there was
something present at that location (a wall), or a "0" if that point in the
maze was empty.  If you moved the mouse through the maze, you'd only be able
to move through the "0"s.  If you tried to move one direction and
encountered a "1" at that position, it would be a wall.

>I think that unless  I radically alter my algorithm or data
>storage method, I will have to use a PIC with more memory
>or EEPROM as suggested. Is EEPROM easy to use in a
>existing program, or will it require lots of rehashing of
>the program and new code ( I'm running out of time for my
>project!)? Does anyone know of any good idiot's guides to
>EEPROM on the web??

You'd need a 4KB EEPROM, or a "32k" EEPROM.  Note that they're specified in
number of bits, not bytes, that they hold.  I'm not sure about the access
time that you need, but at 4MHz the I2C would require ~0.5ms to read a byte
from the chip, or at least ~2ms to write a byte to the chip (1.5ms is the
MINIMUM time, regardless of frequency, that you need to write a byte/page to
the EEPROM.  Sometimes needs 10ms, I think it depends on supply voltage).

--Andrew

--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\03\19@095455 by Roman Black

flavicon
face
john wrote:
{Quote hidden}

Hi John. Good luck using the PIC for this.
Smart mice are usually using larger micros,
like 32k rom with 32k ram. Thats a minimum, the
contest winners are using 1Mb ram etc.
If you get a good smart mouse with a PIC you
deserve a great score!

Even with an eeprom it's not going to be very
easy. Yes you can store wall data as 4 bits per
square. But it's more efficient to store it just
as the right and top wall, as the square below has
its own two walls, as does every square on the grid.
This gets you down to 2 bits per tile.

Does your mouse do 3 minutes exploring and then has
to calculate the shortest path? Maybe use a
right-hand wall following system to quickly map
the maze, then a left wall following system. That
should give most/all of the tiles covered.

Good luck with this, I hope you haven't left it
too late. I think with a 16F876 or 877 you might
have enough ram to do this, but it will be tight.
You can use 2 bits/tile for walls, means 4 bytes
per row x 16 rows. 64 bytes. Then another 4bits
per tile for path computing, another 128 bytes.
That will be annoying on a PIC because of all the
bank switching. :o)

The less ram you use for the array the more work
the path finding algorithm has to do. But you
can do it, even with only 1 bit/tile for path
computing.:o)
-Roman

I can give you some ideas for non-recursive path
finding systems with minimum ram, from the days
when I was on a games programming team. Some of the
games programmers do more AI than the robotics AI
people! ;o)

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\03\20@124049 by Peter L. Peres

picon face
Why can't you use a SEEPROM externally and obtain a lot of non-volatile
memory for 2 IO pins ? The issue of the lifetime would not be a real issue
on a contest robot. Just put the I2C part on a socket so you can put in a
fresh one in the unlikely event that you wear it out. A bit-banged I2C
library takes half a day to write and uses less then 30 words of code
usually. Read access speed will be of the order of magnitude of 100 cycles
per byte (100 usec at 4MHz). Write will be ~3msec/byte. Since you read
much more than you write normally this should be ok anyway.

Peter

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...