Same code in different Pins
Hi!, i am currently developing an application with one wire devices, i have for convenience connected several DS1993 devices to different I/O pins (even from different ports), Is there a way of executing the same code on different pins?.
Can i make this code reusable (something like a funtion gosub) for different pins?
PIN var Portb.0
owout PIN, 1, ["data here"]
how can i change the I/O pin or the var PIN?
Thanks in advance!
Sure its not what i want ;)
That is a simple choice, but the code i posted is just an example, my real code could use up to 800 words, an maybe the code space isnīt enough.
Come on there must be some way, I just donīt understand it, it seems to be in ASM. I really dont know.
SAME QUESTION
How can you change the definition of a variable in the middle of the execution???
PIN var PORTB.0
and later
PIN var PORTB.1
Thanks
Hi, so many replies in hours!!!
Thanks Darrel, yes i am here.... i wasnt but now i am....
Well that is great that at least helps me reduce everything, bad thing is that i already made the PCB, i should get it by thursday... :P
God thing is i Used Portb(ALL) and PortC(2Bits) and portD (2 bits), and PORTA (4bits) 16 1Wire devices.
So i Guess by now i will use Darrel`s recomendation for all portb and change the .bas to use portb A, and maybe handle the rest of the bits with select case :'(.
Darrel by the way.. How then do you use DEFINES to work with your include files? (i dont relly know if yours :p), does this mean that once the defined is set one is supposed to stay with it and not change it?
Thanks to all for your replies, I am still hoping something better could be done
Bye
Assembler Time, i knew it....
Well this device is some kind of 16 ports 1Wire to Serial HUB, it sends serial
data to a pc with the info requested by the PC, maybe write the pages of a 1wire device (0-15 pages), read de Identification from a 1Wire, read some temperatures, you should be able to do anything to any device on the port.
Why?: well in this development I am using up to 16 i-buttons, actually they where read directly through the PC. And i am in Colombia, it is not easy at all to find DS parts, even more it is really expensive.
What kind of info? well mostly OW commands with data bytes, since each page is 32 bytes it would be interesting to receive and send everything in an array 32 bytes long. Exactly?... well $F0, $cc, some bytes... typical protocol bytes for 1wire
Pins used: PORTB (ALL), portA (0-3... i hate pin4 :p), portC(2,3), portd (0,1)
Thats all.... its simpler than it seems i guess.... i might do other simple tasks, but iīm sure i dont need help with that.
I really want to learn this, i m sure you have a great tip behind this request.
Thanks Again
Seems like an idea but....
Quote:
Originally Posted by
skimask
How about using a 74138 (3-8 decoder) or 74154 (4-16 decoder), controlled by either 3 or 4 address lines, to apply a ground to the O.W. device desired (thereby powering it up) and using the same one-wire read/write pin in common to all of them? Surely setting porta.0-porta.3 for an address takes a lot less code space than multiple types of OW commands...
Might not be such a good idea since it'll only save you 3 pins out of your 'Pins used:' list.
And heck, I don't even know if it'll work...
This seems like an idea but it also appeals to me like a waste since i have the micro and i can aviod using more ics.
What is really interesting and almost a need is to discuss if it is posible to use several OW devices conected to the same wire with the OWOUT OWIN commands, i havent really got into the subject but.... how do you assign addreses(ids) to each device conected to the line? I would have to read the document about the OW protocol by maxim, it dont seems to be simple at all.
JAjajajaja I knew it!!! DARREL can!
Oh my God this is awesome, i am going to work on it right now!!! will post as soon as i am finished.
And ...
BRILLIANT!.... by the way. jeje
It also works... of course..
My head is telling me somehow: "You donīt really wanna know":D
Man it seems thought..
I will hold my breath and just go with my happy new versions of the OWPIN? macro.
Gracias otra vez