Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to Path find Algo in PIC16F877a

Status
Not open for further replies.

Sumit_ganvir

Newbie level 5
Joined
Jun 3, 2013
Messages
10
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
MP
Activity points
1,332
Hi
I want to make a prog to find way in matrix...
As If input in PIC IS
00111
10100
01100
01010
11100

Then output will be
00111
00100
01100
01000
11000

I want algo to solve this.......
 

Two of the bits don't change. You also haven't told us what language you use. In 'C' the easist code is probably:

Output = Input;
if(Input == 0x14) Output = 0x04;
if(Input == 0x0A) Output = 0x08;
if(Input == 0x1C) Output = 0x18;

The result is in 'Output'.

Brian.
 

Two of the bits don't change. You also haven't told us what language you use. In 'C' the easist code is probably:

Output = Input;
if(Input == 0x14) Output = 0x04;
if(Input == 0x0A) Output = 0x08;
if(Input == 0x1C) Output = 0x18;

The result is in 'Output'.

Brian.

It's not as ...
I want to input any matrix (as show above OR other).
And By some algo PIC auto generate only one path(i.e group of all 1's in opposit corner of matrix).
111
110
110

so after algo (I.e reduce turn)
111
100
100

I am work with MPlab.
Thank
 

There is no algortithm that converts any input to something different, it depends entirely on the correlation of the data (if any) and size of the matrix.
Your best option is to use a look-up table, load your output matrix into a table and use the value in the input matrix to look up and retrieve the value stored in that entry. The optimum way to do this depends on the family of PIC you are using and the language. MPLAB supports several languages and all PIC families so you would have to be more specific before we can help further.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top