Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Elvis75

  • Rank
  1. Hi, On the ECIO 28 / 40 pin board is the EUART (Rs232) connected in anyway to the USB. My meaning is, can I use both at the same time. E.g. read in on the Rs232, process data, and send data out on USB? Look forward to your reply. Elvis75.
  2. Hi all, Could somebody tell me what this is setting up at the top of the example Ecio code? #pragma DATA 0x300000, 0x20 #pragma DATA 0x300001, 0xe #pragma DATA 0x300002, 0x3e #pragma DATA 0x300003, 0x1e #pragma DATA 0x300004, 0x0 #pragma DATA 0x300005, 0x81 #pragma DATA 0x300006, 0x81 #pragma DATA 0x300007, 0x0 #pragma DATA 0x300008, 0xf #pragma DATA 0x300009, 0x80 #pragma DATA 0x30000a, 0xf #pragma DATA 0x30000b, 0xa0 #pragma DATA 0x30000c, 0xf #pragma DATA 0x30000d, 0x0 Cheers Elvis75
  3. Hi, I have just been to the Matrix site and downloaded the new drivers and the system now works fine. Here is the link to the new drivers: http://www.matrixmultimedia.com/ECIO-X.php Cheers Elvis75
  4. Sourceboost Team, What do you recommend as my next step? Cheers Elvis75
  5. Hi again, I have tried to click on this exe (ECIOprog.exe) and I get the following windows error (MPUSBAPI.DLL not found). I think this maybe the problem. I am currently running xp pro. Any ideas? Cheers Elvis75
  6. Hi all, I have just recieved my new ECIO 28 pin device and im having problems programming the device. I have followed the setup steps and setup the linker path etc. However I think the problem is with the windows xp driver. When I install this, it first pops up in the "universal serial bus controllers - in device manager", and a yellow icon is shown for 5 seconds and then it disappears. If I unplug device and plug back in, the yellow icon comes up for 5 seconds and then disappears. In the SourceBoost IDE I have built the example C program and built and all is fine. When I go to program (I have changed led flash speed), the IDE says programmed, but the led still stays the same speed. One thing I have noticed is the progress bar is not displayed when programming is in operation. I have used the EZ-controller many times so I think I have all setup correctly. Look forward to your input. Hope all this makes sence. Regards, Elvis75
  7. Dave, Excellent. I have just put my order in. Thanks again. Elvis75
  8. Hi all, Im a bit lost with my first spi application. The spi device im talking to requires quite alot of set up code before the data can be retrieved. The example c source code supplied with the spi device was for a 16-bit atmel, and I have converted it to 8-bit c code for the ez-turbo 18f2520 controller. At this point i think my problem has started. The questions i would like to ask are below: 1) is the general flow of setting up the spi correct 2) in main im trying to print out the output from pressure and i get -64? Note sure what this meens? 3) lastly im printing the output out from pressure via rs232, does this affect the spi bus? Look forward to your reply. Cheers tuurbo46 // **** SPI interface 18/05/08- 15.00pm using EZ-Turbo **** #include <system.h> #include <string.h> #include <stdio.h> #include <Rs232.h> #pragma CLOCK_FREQ 40000000 // ******************************** CONSTANTS AREA **************************************** #define WORD unsigned int #define BYTE unsigned char #define Chip_Selet_Low portb.6=0; #define Chip_Selet_High portb.6=1; #define DRDY_HIGH portb.5=1; // ******************************** INITIALISE MICRO *************************************** void Initialise_18F2520_Micro(void) { // Setting up I/O pins porta=0x00; // Clear porta portb=0x00; // Clear portb portc=0x00; // Clear portc trisa=0x0F; // Set port as inputs trisb=0xBF; // Set RB0 enable programming lead, RB6/SPI - output chip select bit trisc=0x97; // RC7/Rx - input, RC6/Tx - output, RC5/SDO - output, RC4/SDI - input, RC3/SCK - output pie1=0; // PIE1=0; Setup_Serial(); // Call Setup_Serial function t1con.0=0; // TMR1ON=0; pir1.0=0; // TMR1IF=0; pir1.5=0; intcon.6=1; // PEIE=1; intcon.7=1; // GIE=1; // Setting up SPI sspcon1.5=0; // Disable serial port sspcon1.5=1; // Enables serial port and configures SCK, SDO, SDI and SS as serial port pins sspcon1.3=0;sspcon1.2=0; sspcon1.1=0; sspcon1.0=1; // 0001 = SPI Master mode, clock = FOSC/16 sspcon1.4=0; // 1 SCK idle, O SCK idle low sspstat.7=0; // 1 = Input data sampled at end of data output time sspstat.6=0; // 0 = Transmit occurs on transition from Idle to active clock state } void Write_Direct_Access_SPI(BYTE address, BYTE data) { address = (address << 2); // #1, shift reg address to left by 2 address |= 0x02; // #2, set write bit to one (RW=1) Chip_Selet_Low; // #3, set CSB to low sspbuf = address; // #4, write register address byte (8bits) while(!pir1.SSPIF) // Buffer full pir1.SSPIF=0; sspbuf = data; // #5, write data byte (8bit) to line while(!pir1.SSPIF) // Buffer full pir1.SSPIF=0; // Wait register address to be written Chip_Selet_High; // 6#, Set CSB to HIGH } void Write_Indirect_Access_SPI(BYTE address, BYTE data) { Write_Direct_Access_SPI(0x02, address); // #1, write reg address to ADDPTR (0x02) Write_Direct_Access_SPI(0x01, data); // #2, write reg data to DATAWR (0x01) Write_Direct_Access_SPI(0x03, 0x02); // #3, write 0x02 to OPERATION (0x03) delay_ms(50); // #4, wait 50ms } unsigned int Read_Direct_Access_SPI(BYTE address, BYTE number_of_bytes) { unsigned int value; value = 0; address = (address << 2); // #1, shift reg address to left by 2 Chip_Selet_Low; // #3, set CSB to low sspbuf = address; // #4, write register address byte (8bits) while(!pir1.SSPIF); // to SPI line by using SPI HW pir1.SSPIF=0; // Wait register address to be written while(number_of_bytes-- > 0) { value <<= 8; sspbuf = 0x00; // #5, Send SCK pulses (=send 0x00 to line) while(!pir1.SSPIF) // Read data from SPI bus. pir1.SSPIF=0; value |= sspbuf; // Read data byte from MCU SPI register } Chip_Selet_High; // 6#, Set CSB to HIGH return value; } unsigned int Read_Indirect_Access_SPI(BYTE address) { unsigned long value; Write_Direct_Access_SPI(0x02, address); // #1, write reg address to ADDPTR (0x02) Write_Direct_Access_SPI(0x03, 0x01); // #2, write 0x01 to OPERATION (0x03) delay_ms(10); // #3, wait 10ms value = Read_Direct_Access_SPI(0x20, 0x02); // #4, read two bytes from DATARD16 (0x20) return value; } void Initialise_Spi_Device(void) { BYTE i; unsigned int DATA; Chip_Selet_High; delay_ms(1); // 1ms wait for(i = 6; i > 0; i--) { DATA = Read_Direct_Access_SPI(0x07, 1);// #4, read STATUS register --> LSB '0'=OK if(!(DATA & 0x0001)) break; delay_ms(10); } if(i == 0) DATA = Read_Direct_Access_SPI(0x1F, 1); // #5, read DATARD8 register --> LSB '1'=OK if(!(DATA && 0x0001)) Write_Indirect_Access_SPI(0x2D, 0x03); // #6, Low noise configuration delay_ms(100); // #7, wait for 100ms Write_Direct_Access_SPI(0x03, 0x00); // Reset operation mode delay_ms(10); // Wait before change new mode Write_Direct_Access_SPI(0x03, 0x0A); // #9, set SCP1000 into 'high resolution' // measurement mode (0x0A) delay_ms(100); } //*********************************** MAIN PROGRAM ROUTINE ************************************ main(void) { //unsigned int temp; unsigned long pressure; Initialise_18F2520_Micro(); Initialise_Spi_Device(); clear_bit( wdtcon, SWDTEN ); // wdtcon.0=0; while(1) { //temp = Read_Direct_Access_SPI(0x21, 2);// Read 2 bytes from TEMPOUT (0x21) //temp = temp & 0x3fff; // Mask bits [13:0] //temp = temp / 20; pressure = (unsigned long)((0x0007) & Read_Direct_Access_SPI(0x1F, 1)); // Read 1 byte from DATARD8 (0x1F) and // mask bits [2:0] in order to get // 3MSB bits for pressure information pressure <<= 16; // shift 3MSB bits to left by 16 pressure |= (unsigned long)Read_Direct_Access_SPI(0x20, 2); // Read 2 bytes from DATARD16 (0x20) in // order to get 16 LSB bits for pressure // information. pressure >>= 2; // Convert to [Pa] by dividing the 19 bit // pressure by 4 --> the 19 bit pattern // is shifted to right by 2 output_int(pressure); sci_CRLF(); delay_ms(100000); delay_ms(100000); delay_ms(100000); } }
  9. Hi all, Im just trying to convert some example code to sourceboost code syntax and im not sure if it is correct. Could somebody confirm the below is correct? 1) while(!SSPIF) is the same as while(pir1.3==0) 2) SSPIF = 0; is the same as pir1.3=0; Look forward to your reply. Elvis75
  10. Hi Dave, Excellent that sounds good. Will the programming cable still program it, and will it still work with the dev board? Lastly do you know when it will be availble? Cheers Elvis75
  11. Hi, Does anybody know when the Ez-controllers are due back in stock? Cheers Elvis75
  12. Hi, Cheers for those links. A big help!! Cheers Elvis75
  13. Hi all, Im about to do an SPI application and I have just looked through the supplied examples. Can I use the I2C example for SPI or is it advisable to start afresh? Look forward to your reply. Elvis75
  • Create New...