Search the Community
Showing results for tags 'SPI'.
-
Hi all, I will not use the SDcard. I will use a capacitive touch sensor TTP229 at 2 wires(16 keys). http://www.tontek.com.tw/download.asp?sn=726 I was able to use the sensor on the J16. using the "SI" and "SC" pin. How to configure the J16 pins for two "SI" inputs?Or how to configure II2C and I2S for SI and SC? I want to use at least two TTP229 Below the code for J16 PIN SI. mios32_config.h #define MIOS32_SPI0_IN_INIT { MIOS32_SYS_LPC_PINMODE(1, 24, 2); \ MIOS32_SYS_LPC_PINMODE(1, 23, 0); \ MIOS32_SYS_LPC_PINMODE(1, 22, 2); \ MIOS32_SYS_LPC_PINMODE(1, 21, 2); \ MIOS32_SYS_LPC_PINMODE(1, 20, 2); } APP.C u8 receive; u8 receive1; u8 flag1=0; u8 flag2=0; char valor1; char valor2; void APP_Init(void) { // initialize all LEDs MIOS32_BOARD_LED_Init(0xffffffff); MIOS32_SPI_Init(0); MIOS32_SPI_IO_Init(0,MIOS32_SPI_PIN_DRIVER_STRONG); MIOS32_SPI_TransferModeInit(0,MIOS32_SPI_MODE_CLK1_PHASE1,MIOS32_SPI_PRESCALER_8); } void APP_Tick(void) { receive=MIOS32_SPI_TransferByte(0,receive); /////valor 255 if not pressed receive1=MIOS32_SPI_TransferByte(0,receive1);////valor 255 if not pressed if(receive<255 && flag1==0)//////if pressed { valor1=receive-127; MIOS32_MIDI_SendNoteOn(DEFAULT, Chn4, valor1, 127); flag1=1; // MIOS32_MIDI_SendDebugMessage("Recebido:%u FLAG1:%u\n",valor1, flag1); } if(receive==255 && flag1==1 ) { MIOS32_MIDI_SendNoteOff(DEFAULT, Chn4, valor1, 0); flag1=0; } if(receive1<255 && flag2==0)//////if pressed { valor2=receive1-127; MIOS32_MIDI_SendNoteOn(DEFAULT, Chn5, valor2, 127); flag2=1; } if(receive1==255 && flag2==1) { MIOS32_MIDI_SendNoteOff(DEFAULT, Chn5, valor2, 0); flag2=0; } } Video Test in Portuguese ...
-
I haven't been able to find any reference to this info on uCapps.de and the forum so it's reference info for anyone who wants to connect an external SD card socket and ENC28J60 based ethernet board at the same time. Both of these devices are connected to the core with SPI. While I have been try to get them both to work at the same time I have learnt that SPI can be connected in two ways, "Star" and "Chain". The SD card socket and ethernet module need to connected in a "Star" configuration in order to work. Basically the two devices share Serial In (MOSI) , Serial Out (MISO) and Serial Clock (SCK) signals but each have individual Slave Select (SS) signals. The attached picture illustrates this pretty well.
-
Hi guys, I'm currently in the process of planning a PIC-based capacitive touch device (2D panel, 12cm x 12cm). First and foremost I want to use it via USB but eventually it could communicate via serial connection. So there is a chance it might output data for midibox projects. Wondering what would be the best way of talking to a midibox I had a look at the serial-register-based DOUT modules (e.g. http://ucapps.de/mbhp/mbhp_doutx4_r5.pdf ). So what we have here is an SPI-based communication and a hardware layout for a 2x5 pin header which I could easily use. I'm just having a hard time deciding on what to do with power levels. If no USB power is provided the device could be supplied by the 5V power from the midi box (also made available through the pin header). However, since it's a 3.3V IC a power regulator will have to be used. Easy. But I guess the SPI signal levels from the midibox master will be 5V as well, right? So do you think I'll run into some problems when my 3.3V PIC microcontroller will receive e.g. an SPI clock at 5V? I guess it will always have to send its data (MISO-path) at 3.3V, right? What would be suitable (yet simple!) hardware workarounds to provide a bus interface that is flexible in terms of signal levels?