Showing posts with label communication. Show all posts
Showing posts with label communication. Show all posts

Thursday, January 12, 2012

FINAL -- duh!! -- so far..

Well, a final mark of 57 (C) was a bit underwhelming, but at least it's better than a poke in the eye with a burnt stick!

i wish i knew how to make Georgia Bold my default font on this blog but..

& i'm not going to stop playing around with these things, but i've got rather a lot on at the moment, & i need to get thees out of my hair: 

the leaks in my hall roof; 

dealing to the undergrowth that is my yard (majorly chopped with a grunty weed-whacker, but still in need of further 'treatment') - i have an abiding hatred of grass - the agricultural kind, not friend Mary Jane - which i regard as suitable only for football & other sports to be played on & livestock to shit on; as a domestic ground cover it sucks enormously;

my feeble-minded computer - the poor wee thing does its best, but with the equivalent these days of a pre-frontal lobotomy (half-a-Gig), it desperately needs me to take pity on it & beef up its RAM (to at least 2 Gig);

there's a thing out the back masquerading as a shed; needs replacing or turned into a workshop-type thingy..;

a giant, non-producing, plum tree out the back needs topping ( i know it's a plum because it actually has delivered one or two plums occasionally (i'm not joking!), one of which has grown into a smaller, equally non-producing, tree - i need some arborist's/orchardist's advice maybe;

the inside of my house is a f*****g tip - it really needs sorting!

& NO i haven't made any poxy New Year's resolutions either!

(except maybe to bow to the inevitable & sign up to Facebook - not because i've any wish to dump myself online, but various friends keep asking me, & i'd like to be able to access their stuff.)

Sunday, September 18, 2011

Task 27 -- The Wire Librrary

27. List the main functions of the Wire library.
       Say what they do with examples.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Wire Library Functions
======================

1.    begin()
      begin(address)

Initiates the Wire library and joins I2C bus as master or slave.
Normally called only once.

Parameters: address: the 7-bit slave address (optional);
        if not specified, join the bus as a master.
No returns.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2.  requestFrom(address, count)

Used by master to request bytes from slave device.
The bytes may then be retrieved with the available() and receive() functions.

Parameters:    address:  the 7-bit address of device to request bytes from
        quantity: the number of bytes to request
No returns.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


3.  beginTransmission(address)

Begin transmission to I2C slave device with address given.
Queue bytes for transmission with send() function.
Transmit bytes by calling endTransmission().

Parameters: address: 7-bit address of device to transmit to
No returns.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


4.  endTransmission()

Ends transmission to slave device begun by beginTransmission()
Actually transmits the bytes queued by send().

No parameters.

Returns: byte, indicating transmission status:

0   success
1   data too long to fit in transmit buffer
2   received NACK on transmit of address
3   received NACK on transmit of data
4   other error.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


5.  send()

Sends data from slave device in response to request from master, or
queues bytes for transmission from master to slave device
(in-between calls to beginTransmission() and endTransmission()).

Parameters: value:      a byte to send (byte)
        string:     a string to send (char *)
        data:       an array of data to send (byte *)
        quantity:     the number of bytes of data to transmit (byte)
No returns.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

6.  byte available()

Returns number of bytes available for retrieval with receive().
Should be called on master device after call to requestFrom(),
or on slave inside the onReceive() handler.

No parameters;
Returns:  number of bytes available for reading.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

7.  byte receive()

Retrieves byte transmitted from slave device to master
after call to requestFrom()
         or transmitted from master to slave.

No parameters;
Returns:  next byte received.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8.    onReceive(handler)
9.    onRequest(handler)

These are not much used in our projects.

Note: On most Arduino boards,
                   SDA (data line) is on analog input pin 4, and
                   SCL (clock line) is on analog input pin 5.


Reference:  http://arduino.cc/en/Reference/Wire
.

Wednesday, July 27, 2011

The asynchronous packet in RS232 transmission

The diagram isn't helpfully large but here's a text-type link

Here's a Wikipedia link from which comes the diagram at left.










Note that this one has:

* a start bit
* 8-bit data transmission (limited ASCII may use only 7 bits)
* a single ( the usual) stop bit

* no parity bit (parity can be even or odd).




The RS-232 asynchronous Tx-Rx protocol