Для этого разработал на основе микросхемы PCFP плату клавиатуры из 5 кнопок. Приобрел я партию из двух таких микросхем за 0. Покупка выгодная, так как в местных магазинах эти же микросхемы стоят больше 2 долларов за штуку. Дисплеем HMI будет стандартный экранчик , так же через платку FC работающий по квадратной шине. PCFP выслали, дали трек-номер и через 2 недели я их уже получил на почте.

Author:Voodoojinn Malagis
Language:English (Spanish)
Published (Last):3 January 2009
PDF File Size:3.50 Mb
ePub File Size:15.72 Mb
Price:Free* [*Free Regsitration Required]

It is one of the many GPIO extenders available in the market. This tiny little board becomes a life saver When you run out of pins on your Arduino. These modules run on the I2C bus, and if daisy-chained you can connect upto 8 of these devices in a project.

You just need to hook them up to the I2C bus and you are all ready to go. For now we will just cover the basics of I2C and we will jump to our main topic. Usually there is one master and one or multiple slaves on the line, however there can be multiple masters aswell. Both masters and slaves can transmit or receive data. The Address range of PCF is from 0x20 to 0x27 7 bit address mode. Default address is 0x By default all these pins are grounded or LOW.

Pull-up resistors are not needed for these pins. Pin 13 is for the Interrupt Output. Connect it to the VCC using a pull-up resistor. The major difference is the addressing scheme. The lower three bits are the settings on the device pins A2, A1, and A0. In applications requiring additional drive, two port pins may be connected together to sink up to 50mA current.

Then we have these ports which can be used to piggyback another one of these boards. If we look at the back of the board the pins are all labeled starting from P0 to P7 and then ending with the INTrupt pin. When you are using multiple of these you can switch the address by adjusting these jumperAddress bars.

This is how an address byte of the PCF looks like. First 7-bits combine to form the slave address. The last bit of the slave address defines the operation read or write to be performed. When it is high 1 , a read is selected, while a low 0 selects a write operation. You may need to create the libraries sub-folder if this is your first library.

Restart the IDE and then you should be able to use the library in your code. This library also comes with very good examples which will help you in getting your hands on the IO Expander. Connect:VCC to 3. Therefore, it sometimes becomes hard to figure out what address has been allocated to the expander. Moreover, if there are two or more devices on the I2C bus it is always a good idea to check if any one of them is conflicting with other one. When loaded to an Arduino, the sketch scans the I2C network, showing the addresses that respond.

Attachments I2CScanner. First you need to include the "PCF Step Write Value Now, to write a value, you just need to call the "digitalWrite" function and pass the pin-number followed by the mode:PCF As per the code the LEDs attached to P0 and P1 of the expander should alternate and blink, and thats exactly whats happening here, bingo. Attachments WriteValue.

The code is very simple and it just reads the value of the pin P1 in a loop. I am using this pushbutton to change the state of the pin P1.

Attachments ReadValue. However, because of the pin-number limitation on packages, most microprocessors have only one or two interrupt lines. Consequently, several devices usually are connected to the same interrupt line. The drawback to this configuration is that the overhead processing time to identify the device that requested the interrupt service may be too long in the order of microseconds.

The PCF provides an open-drain interrupt INT output that can be fed to a corresponding input of the microprocessor. To learn more about interrupts, please read the attached datasheet.

To use interrupts you must initialize the pin and the function to call when PCF raises an interrupt, once done you can use the interrupt routine in your program.


Tutorial – PCF8574 backpacks for LCD modules and Arduino

If you have not already, please read and understand the first I2C article before continuing. First of all, there are some limitations of I2C to take into account when designing your projects. If all your devices are on the same PCB, then there is nothing to worry about, however if your I2C bus is longer than around one metre, it is recommended that you use an I2C bus extender IC. These ICs reduce electrical noise over the extended-length bus runs and buffer the I2C signals to reduce signal degradation and chance of errors in the data. Using a pair of these ICs, you can have cable runs of 20 to 30 metres, using shielded twisted-pair cable. This gives us another eight outputs, in a very similar method to the 74HC; or can be used as eight extra inputs.


PCF8574P: подключение кнопок к Arduino по шине I2C или Люк Скайуокер наносит удар

Для этoгo рaзрaбoтaл нa ocнoвe микрocxeмы PCFP плaту клaвиaтуры из 5 кнoпoк. Приoбрeл я пaртию из двуx тaкиx микрocxeм зa 0. Пoкупкa выгoднaя, тaк кaк в мecтныx мaгaзинax эти жe микрocxeмы cтoят бoльшe 2 дoллaрoв зa штуку. Диcплeeм HMI будeт cтaндaртный экрaнчик , тaк жe чeрeз плaтку FC рaбoтaющий пo квaдрaтнoй шинe. PCFP выcлaли, дaли трeк-нoмeр и чeрeз 2 нeдeли я иx ужe пoлучил нa пoчтe. Извлeкaeм из плacтикoвoй трубки, врoдe бы вce нoрмaльнo.

Related Articles