![](/media/cache/profiles/a53d1388191884b75c48bebb18709bfb.50x50_q85.jpg)
demo sample to drive PCU9955 and PCA9629
Dependencies: mbed I2C_slaves PCU9669 parallel_bus
Fork of mini_board_PCU9669 by
What is this?
This is a sample code to operate PCU9955 (16ch constant-current LED controller) and PCA9629 (intelligent stepper motor controller) through PCU9669 (3 channels (UltraFast mode * 2ch, FastModePlus *1ch) I2C bus controller).
This demo is written based on mini_board_PCU9669 sample code library and its API.
http://mbed.org/users/nxp_ip/code/mini_board_PCU9669/
Demo will shows how the LED controllers and stepper motor controllers works.
It uses a mini_board_PCU9669 board with mbed, 8 of PCU9955s and 5 PCA9629s.
Demo setup
(left-top: PCU9955 boards, left-bottom: mini-board PCU9669 with mbed, right: PCA9629 x5 board)
Board connections and device addresses
Reference:
User manual of PCU9669 demo board: Mini board PCU9669
http://www.nxp.com/documents/user_manual/UM10580.pdf
sample code : mbed programs
Import programmini_board_PCU9669
mini board PCU9669 (and PCA9665) sample code
Import programPCA9955_Hello
PCA9955 16 channel current drive(sink) LED driver sample code
Import programPCA9955_simple
very simple sample code for PCA9955 (16 channel current control LED driver)
Import programPCA9629_Hello
Sample code for PCA9629 operation
device infomation
PCU9669 (Parallel bus to 1 channel Fm+ and 2 channel UFm I2C-bus controller)
PCU9955 (16-channel UFm I²C-bus 57 mA constant current LED driver)
PCA9955 (16-channel Fm+ I²C-bus 57 mA constant current LED driver)
PCU9629 (Fm+ I2C-bus stepper motor controller)
PCx9955_reg.h@21:3b75b545ecfb, 2012-10-26 (annotated)
- Committer:
- nxp_ip
- Date:
- Fri Oct 26 07:03:47 2012 +0000
- Revision:
- 21:3b75b545ecfb
- Parent:
- 20:a266fa588bd8
PCU9669, PCU9955 and PCA9629 demo code version 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nxp_ip | 20:a266fa588bd8 | 1 | /* A sample code for PCU9669 (and its family) operation sample |
nxp_ip | 20:a266fa588bd8 | 2 | * |
nxp_ip | 20:a266fa588bd8 | 3 | * @author Tedd OKANO, NXP Semiconductors |
nxp_ip | 20:a266fa588bd8 | 4 | * @version 0.5 |
nxp_ip | 20:a266fa588bd8 | 5 | * @date 13-Oct-2011 |
nxp_ip | 20:a266fa588bd8 | 6 | * |
nxp_ip | 20:a266fa588bd8 | 7 | * Released under the MIT License: http://mbed.org/license/mit |
nxp_ip | 20:a266fa588bd8 | 8 | * |
nxp_ip | 20:a266fa588bd8 | 9 | * An operation sample of PCU9669 I2C bus controller. |
nxp_ip | 20:a266fa588bd8 | 10 | * The mbed accesses the PCU9669's parallel port (8 bit address and 8 bit data) using bit-banging. |
nxp_ip | 20:a266fa588bd8 | 11 | * The bit-banging is poerformed by PortInOut function of mbed library. |
nxp_ip | 20:a266fa588bd8 | 12 | * |
nxp_ip | 20:a266fa588bd8 | 13 | * To make the code porting easier, all codes are partitioned into layers to abstract other parts. |
nxp_ip | 20:a266fa588bd8 | 14 | * The mbed specific parts are concentrated in lowest layer: "hardware_abs.*". |
nxp_ip | 20:a266fa588bd8 | 15 | * This module may need to be modified when porting. |
nxp_ip | 20:a266fa588bd8 | 16 | * |
nxp_ip | 20:a266fa588bd8 | 17 | * All other upper layers are writen in standard-C. |
nxp_ip | 20:a266fa588bd8 | 18 | * |
nxp_ip | 20:a266fa588bd8 | 19 | * base code is written from 05-Sep-2011 to 09-Sep-2011. |
nxp_ip | 20:a266fa588bd8 | 20 | * And demo code has been build on 11-Sep-2011. |
nxp_ip | 20:a266fa588bd8 | 21 | * Debug and code adjustment has been done on 08-Sep-2011. |
nxp_ip | 20:a266fa588bd8 | 22 | * Small sanitization for main.cpp. All mbed related codes are moved in to "hardware_abs.*". 13-Oct-2011 |
nxp_ip | 20:a266fa588bd8 | 23 | */ |
nxp_ip | 20:a266fa588bd8 | 24 | |
nxp_ip | 20:a266fa588bd8 | 25 | /** PCx9955 (PCU9955 and PCA9955) related definitions |
nxp_ip | 20:a266fa588bd8 | 26 | * |
nxp_ip | 20:a266fa588bd8 | 27 | * PCx9955's internal register name and address definitions, I2C address difinitions |
nxp_ip | 20:a266fa588bd8 | 28 | */ |
nxp_ip | 20:a266fa588bd8 | 29 | |
nxp_ip | 20:a266fa588bd8 | 30 | #ifndef __PCx9955_REG__ |
nxp_ip | 20:a266fa588bd8 | 31 | #define __PCx9955_REG__ |
nxp_ip | 20:a266fa588bd8 | 32 | |
nxp_ip | 20:a266fa588bd8 | 33 | /** @var Register names |
nxp_ip | 20:a266fa588bd8 | 34 | * |
nxp_ip | 20:a266fa588bd8 | 35 | * PCx9955 internal register name and addesses |
nxp_ip | 20:a266fa588bd8 | 36 | */ |
nxp_ip | 20:a266fa588bd8 | 37 | typedef enum { |
nxp_ip | 20:a266fa588bd8 | 38 | MODE1 = 0x00, |
nxp_ip | 20:a266fa588bd8 | 39 | MODE2, |
nxp_ip | 20:a266fa588bd8 | 40 | LEDOUT0, |
nxp_ip | 20:a266fa588bd8 | 41 | LEDOUT1, |
nxp_ip | 20:a266fa588bd8 | 42 | LEDOUT2, |
nxp_ip | 20:a266fa588bd8 | 43 | LEDOUT3, |
nxp_ip | 20:a266fa588bd8 | 44 | GRPPWM = 0x08, |
nxp_ip | 20:a266fa588bd8 | 45 | GRPFREQ, |
nxp_ip | 20:a266fa588bd8 | 46 | PWM0 = 0x0A, |
nxp_ip | 20:a266fa588bd8 | 47 | PWM1, |
nxp_ip | 20:a266fa588bd8 | 48 | PWM2, |
nxp_ip | 20:a266fa588bd8 | 49 | PWM3, |
nxp_ip | 20:a266fa588bd8 | 50 | PWM4, |
nxp_ip | 20:a266fa588bd8 | 51 | PWM5, |
nxp_ip | 20:a266fa588bd8 | 52 | PWM6, |
nxp_ip | 20:a266fa588bd8 | 53 | PWM7, |
nxp_ip | 20:a266fa588bd8 | 54 | PWM8, |
nxp_ip | 20:a266fa588bd8 | 55 | PWM9, |
nxp_ip | 20:a266fa588bd8 | 56 | PWM10, |
nxp_ip | 20:a266fa588bd8 | 57 | PWM11, |
nxp_ip | 20:a266fa588bd8 | 58 | PWM12, |
nxp_ip | 20:a266fa588bd8 | 59 | PWM13, |
nxp_ip | 20:a266fa588bd8 | 60 | PWM14, |
nxp_ip | 20:a266fa588bd8 | 61 | PWM15, |
nxp_ip | 20:a266fa588bd8 | 62 | IREF0 = 0x22, |
nxp_ip | 20:a266fa588bd8 | 63 | IREF1, |
nxp_ip | 20:a266fa588bd8 | 64 | IREF2, |
nxp_ip | 20:a266fa588bd8 | 65 | IREF3, |
nxp_ip | 20:a266fa588bd8 | 66 | IREF4, |
nxp_ip | 20:a266fa588bd8 | 67 | IREF5, |
nxp_ip | 20:a266fa588bd8 | 68 | IREF6, |
nxp_ip | 20:a266fa588bd8 | 69 | IREF7, |
nxp_ip | 20:a266fa588bd8 | 70 | IREF8, |
nxp_ip | 20:a266fa588bd8 | 71 | IREF9, |
nxp_ip | 20:a266fa588bd8 | 72 | IREF10, |
nxp_ip | 20:a266fa588bd8 | 73 | IREF11, |
nxp_ip | 20:a266fa588bd8 | 74 | IREF12, |
nxp_ip | 20:a266fa588bd8 | 75 | IREF13, |
nxp_ip | 20:a266fa588bd8 | 76 | IREF14, |
nxp_ip | 20:a266fa588bd8 | 77 | IREF15, |
nxp_ip | 20:a266fa588bd8 | 78 | OFFSET = 0x3A, |
nxp_ip | 20:a266fa588bd8 | 79 | SUBADR1, |
nxp_ip | 20:a266fa588bd8 | 80 | SUBADR2, |
nxp_ip | 20:a266fa588bd8 | 81 | SUBADR3, |
nxp_ip | 20:a266fa588bd8 | 82 | ALLCALLADR, |
nxp_ip | 20:a266fa588bd8 | 83 | RESERVED1, |
nxp_ip | 20:a266fa588bd8 | 84 | RESERVED2, |
nxp_ip | 20:a266fa588bd8 | 85 | RESERVED3, |
nxp_ip | 20:a266fa588bd8 | 86 | PWMALL, |
nxp_ip | 20:a266fa588bd8 | 87 | IREFALL, |
nxp_ip | 20:a266fa588bd8 | 88 | EFLAG0, |
nxp_ip | 20:a266fa588bd8 | 89 | EFLAG1, |
nxp_ip | 20:a266fa588bd8 | 90 | |
nxp_ip | 20:a266fa588bd8 | 91 | REGISTER_START = MODE1, |
nxp_ip | 20:a266fa588bd8 | 92 | LEDOUT_REGISTER_START = LEDOUT0, |
nxp_ip | 20:a266fa588bd8 | 93 | PWM_REGISTER_START = PWM0, |
nxp_ip | 20:a266fa588bd8 | 94 | IREF_REGISTER_START = IREF0, |
nxp_ip | 20:a266fa588bd8 | 95 | } |
nxp_ip | 20:a266fa588bd8 | 96 | command_reg; |
nxp_ip | 20:a266fa588bd8 | 97 | |
nxp_ip | 20:a266fa588bd8 | 98 | /** @var PCx9955 I2C bus addresses |
nxp_ip | 20:a266fa588bd8 | 99 | */ |
nxp_ip | 20:a266fa588bd8 | 100 | typedef enum { |
nxp_ip | 20:a266fa588bd8 | 101 | PCx9955_ADDR0 = 0xC0, |
nxp_ip | 20:a266fa588bd8 | 102 | PCx9955_ADDR1 = 0xC2, |
nxp_ip | 20:a266fa588bd8 | 103 | PCx9955_ADDR2 = 0xC4, |
nxp_ip | 20:a266fa588bd8 | 104 | PCx9955_ADDR3 = 0xC6, |
nxp_ip | 20:a266fa588bd8 | 105 | PCx9955_ADDR4 = 0xC8, |
nxp_ip | 20:a266fa588bd8 | 106 | PCx9955_ADDR5 = 0xCA, |
nxp_ip | 20:a266fa588bd8 | 107 | PCx9955_ADDR6 = 0xCC, |
nxp_ip | 20:a266fa588bd8 | 108 | PCx9955_ADDR7 = 0xCE, |
nxp_ip | 20:a266fa588bd8 | 109 | PCx9955_ADDR8 = 0xD0, |
nxp_ip | 20:a266fa588bd8 | 110 | PCx9955_ADDR9 = 0xD2, |
nxp_ip | 20:a266fa588bd8 | 111 | PCx9955_ADDRA = 0xD4, |
nxp_ip | 20:a266fa588bd8 | 112 | PCx9955_ADDRB = 0xD6, |
nxp_ip | 20:a266fa588bd8 | 113 | PCx9955_ADDRC = 0xD0, |
nxp_ip | 20:a266fa588bd8 | 114 | PCx9955_ADDRD = 0xD2, |
nxp_ip | 20:a266fa588bd8 | 115 | PCx9955_ADDRE = 0xD4, |
nxp_ip | 20:a266fa588bd8 | 116 | PCx9955_ADDRF = 0xD6 |
nxp_ip | 20:a266fa588bd8 | 117 | } |
nxp_ip | 20:a266fa588bd8 | 118 | pcx9955_addr; |
nxp_ip | 20:a266fa588bd8 | 119 | |
nxp_ip | 20:a266fa588bd8 | 120 | |
nxp_ip | 20:a266fa588bd8 | 121 | |
nxp_ip | 20:a266fa588bd8 | 122 | #endif // __PCx9955_REG__ |