Bjorn Again Hi,
I guess that you are interested in programming for an embedded system, a
microcontroller based board. There are so many different controllers and
each of them does it, probably in a different way.
The first step is to know your hardware. You must know whether the 'pin' you
like to modify is I/O mapped or is it memory mapped. You should know what is
the port's physical address and the proper LOGIC to use while approaching
that port.
Your programming can be done using a low level language (assembler) or even
'C' or any other high level language that has a compiler for your
controller.
Usually many bits share the same physical address (8, 16, 32, ...) bits
which means that when you write to the ports address, more than a single bit
may be influenced. One way to avoid such changes is to keep a record of the
last known content that was written to that port. When you like to modify a
bit in this case you do it to your 'backup' copy and re-write the modified
value to the ports address.
When your system is more complex, and in cases that more than a single
controller can have access to the same port, it would be wise to protect
against simultaneous writes using hardware or software tools.
To summarize the above said, modifying a bit content means to write to ports
address. In 'C' any command that achieves that will do (a = 17, *b = 23,
etc.). The only requirement is that the physical address that 'a' or '*b'
points at are the location of the port you need to change.
And back to step 1, you must know in an embedded system the hardware.
I wish you luck.
Moshe okman

-----Original Message-----
From: Bjorn Again [mailto:[email protected]] 
Sent: Tuesday, August 10, 2010 6:02 AM
To: [email protected]
Subject: RE: [c-prog] want to learn C, can someone give me an example?


I am sure that I can buy a 250$ compiler to convert PBasic to hex, or ASM,
or C, but there has to be an easier way!  All the books on C I can find are
oriented towards computer programming, not towards low level microcontroller
operations.  This project I am referencing here is a simple clock program,
that will control 6 ICs.  I don't know how, in C to do pin high/low
statements and pauses, which is all I really need!
I have MPlab IDE and the Pickit 2 to program and debug, but without the
proper language to program a PIC with, I'm in Limbo!
I'm pulling my hair out here!

Shane

To: [email protected]
From: [email protected]
Date: Mon, 9 Aug 2010 23:03:00 +0100
Subject: Re: [c-prog] want to learn C, can someone give me an example?


















 



  


    
      
      
      [replying on-list]



On Mon, Aug 9, 2010 at 10:35 PM, [email protected]

<[email protected]> wrote:

> I need to send a binary high or low over pins 1,2,4,8.  I'm sending the
data

> to a 74141 Dixie bcd.



Means not a lot to me, though I suspected you were expecting hardware

output, hence the question.



There's no 'standard' way of doing what you want - it's likely to be

highly hardware/compiler specific.



Which compiler do you have available for the hardware, if any?



-- 

PJH



    
     

    
    






                                          

[Non-text portions of this message have been removed]



------------------------------------

To unsubscribe, send a blank message to
<mailto:[email protected]>.Yahoo! Groups Links





Reply via email to