Jump to content

fransp

EstablishedMember
  • Content Count

    48
  • Joined

  • Last visited

Everything posted by fransp

  1. I found it! linker option -rt <the address> Thanks for reading and thinking. Frans.
  2. Hi, All, It has not happend jet, overwriting my bootloader, but Murphy says it will one day. How do I tell BoostC to protect my bootlader in the upper 256 bytes. I have seen, in CCS. #org 0x0F00,0x0FFF Thanks, Frans.
  3. Hi All, Does someone have experience with a D2XX driver for the FTDI FT232BM on Terminal of SourceBoost? This D2XX drive, instead of a VCP ( Virtual Com ), was needed with my previous development system for downloading. With best regards. Frans.
  4. Hi Pavel,David, Did you ever thought of lining up the horizontal scroll button in the code editor window in SourceBoost IDE with the tab distance? With best regards, Frans.
  5. Hi Paul, How sure are you that the PIC is really running. Why don't you put a blinking character on the display, not too fast, not timed by interrupt :-) but software in your main/while(1) So then when this character is blinking you now the PIC is running. In every project I always try to have a free pin, so I can put a LED/ or scope on it and watch the activity. I will search further because in my current project Timer2 is on the menu too, although the interrupt loopt is running here on a F874 [ That is all I have at the moment. ] Late note: In thr tmrhandler you have this FSR, INDF saving and restoring. Any particular reason to do that?. Or just a left over from troubleshoot! With best regards, Frans.
  6. Hi Paul, You are right I found it. Maybe Dave is right, normally PR is 255 at start-up as the data sheet says. But in your code I found a _PR2 = 10 It is just after the clear_bit (_ANSEL, _ANS6 )..... I also noticed you commented out the adres of _ANSEL. With best regards, Frans.
  7. Hi Paul, Forget about my previous post. I made a mistake there, 2 changes at once leaves the error syndrome. but you forgot to turn on timer 2 Put: set_bit ( _T2CON , TMR2ON ) ; in the setup. With best regards. Frans.
  8. Hi Paul, Try this in your interrupt. if ( (_PIR1 & 2) != 0 ) I hope this is in time and helps. With best regards, Frans. Note: I edited it to your naming of registers. Frans.
  9. Hi All, This month in Circuit Cellar, #178, May 2005, a short resume of BoostC as part of a feature article about USB Interface development. With best regards, Frans.
  10. Hi Paul, I am not familiar wiht the particular chip, but ... Did you? Have the Global interrupt enable flag set to on? Have the individual peripheral interrupt enable set to on? Do not forget to clear the individual peripheral interrupt flag just before leaving the interrupt code, when you have dealt with the interrupt code. Depending on the chip, sometimes peripherals wont work with their interrupt flag still set. In these cases you have to clear the flags outside the interrupt loop. I hope this helps. Frans.
  11. Hi LcSD53, Thanks for the link. I did a quick read, it may take awhile before I realy understand it. The last pragraph of the text in the link does not make things better. I hope I will be cured some day. :-) In the mean time it will be trial and error. I guess. With best regards, Frans.
  12. Hi Dave, When this holidays week is over I will print the manuals on decent color printer to read while commuting. Thanks for the wonderfull SourceBoostIDE. With best regards, Frans.
  13. Hi, Dave,Pavel, Additon of a feature which allows you to sent a selected declaration to the header file as a prototype. It can be extend to have the external qualification added on demand. A right mouse feature typically. A swap source/header exists but this feature does not need the copy/swap/paste maneuver. With best regards, Frans.
  14. Hi Dave,Pavel, Addition of a feature which enable you to indent or outdent a selected segment of code. Imagine you have just added another other loop to your code and now yo are shifting the code to match you favorite layout. With best regards, Frans.
  15. Hi Pavel, I have sent the details to support. Attachment is: Uppercasings With best regards, Frans.
  16. Hi All, I managed to get the code tags right this time. Frans.
  17. Hi Dave, Pavel, Symptom: SourceBoostIDE. All characters are converted to Upper case when Match Case in Search options is not checked and the search criteria is met. Wanted behaviour: Leave character in their respective case. Use Match Case only as a search criterium. With best regards, Frans.
  18. Hi Dave, Ok, I have worked out a complete example, including test to validate the method. There is plenty of comment to follow what I am doing and for what purpose. Thanks for having me do this. I enjoyed every mistake of it. For All, Here is my implementation of the C2C example about Reading, Writing and Erasing the EEprom under program control. There are three routine's for Writing, Reading and Erasing. The Main routine is for testing and showing the code is doing what it is supposed to do. This is the header file. #ifndef _EEPROM_READ_WRITE_H_ #define _EERPOM_READ_WRITE_H_ // General defines, could have been in system.h? #define _EEPROM 0X2100 // Definition of device. // Example target 16F874, check the Settings/Target... // example CLOCK 20MHz, to make delay_ work on time. #pragma CLOCK_FREQ 20000000 // These are needed too, but may vary with the application. #pragma DATA _CONFIG, _PWRTE_OFF & _BODEN_OFF & _WDT_OFF & _LVP_ON & _CPD_OFF & _DEBUG_OFF & _HS_OSC & _CP_OFF // note: this is actually done at programming the device. // change the data to make Test 1 fail. #pragma DATA _EEPROM,55 // my handy defines // pin handling #define in 1 // gate logic #define out 0 #define on 1 // pin logic #define off 0 // Prototyping board specific // LED is as per prototype board PIC-P40-USB-20MHz by Olimex. // bit allocations volatile bit LED@PORTE.1; volatile bit LED_pin@TRISE.1; // Configuration of pins is done in main. // Defines for configuration // Definition for all analog pins to digital #define alldigital 0x06 #endif //_EEPROM_READ_WRITE_H_ This is de code file: #include <system.h> #include "Eeprom_read_write.h" /* Demonstration of the write eeprom, read eeprom functions. Written in BoostC. Based on EEPROM routines from C2C example by Petr Mervart. This demo program was written for a PIC16F874 on a Olimex prototyping board type: PIC-P40-USB-20MHz I use the Shane Tolmie bootloader and downloader. The downloader was modified by Stef Mientky for direct access of the FTDI FT 232BM USB to serial converter. OS WinXP. Documentation: C2C example of Petr Mervart. PIC16F87XA Datasheet, DS39583B, page 33-36 Note: in BoostC : the actual registers are in lower case. the constants are in upper case. viz: clear_bit( eecon1,EEPGD ) */ // You can fill the eeprom at programming time with // #pragma DATA 0x2100,data,<data> // see: .h void eeprom_write ( char adresa , char data ) //write to eeprom { // we check for a writing finish at the end. eeadr = adresa; // the address eedata = data; // the data clear_bit( eecon1,EEPGD ); // make sure we do write to data memory. set_bit( eecon1,WREN ); // enabel writing. // clear_bit( intcon , GIE ); // disable interrupts when using them asm{ movlw 0x55 // special sequence to unlock programming. movwf _eecon2 movlw 0xAA movwf _eecon2 } set_bit( eecon1, WR ); // start writing. while( test_bit( eecon1 , WR )); // cycle until WR reg. eecon1 = 1 (writing...) clear_bit( eecon1, WREN ); // disable writing. clear_bit ( pir2 , EEIF ); // datasheet says clear also interrupt EEIF // set_bit( intcon , GIE ); // enable interrupts when using them } // char eeprom_read( char adresa ) // read from eeprom { eeadr = adresa; // the address clear_bit( eecon1,EEPGD ); // make sure we read the eeprom set_bit( eecon1, RD ); // start reading return eedata; // return the byte } // //The original EERPOM_NULL was rewritten to this eraser. void eeprom_erase ( char adresa , char size ) // erase eeprom { char i; for (i = 0; i < size; i++ ) { eeprom_write( adresa+i , 0 ); } } // void main() { char i,j,k,m; // Configuration as needed for my prototype board. // to use analog ports as digital clear_bit ( trise, PSPMODE ); // have to switch off slave port pins in E adcon1 = alldigital; // have to set the analog/Vref/digital selection. // define direction of LED pin. LED = off; // first put it off i.e. inactive state. LED_pin = out; // then switch it to ouput. // end configuration. // The Tests. // I have no LCD or serial com ready for the proto board. // Test 1: This will test the #pragma _EEPROM and reading of the eeprom. // It will lit the LED when test passes i.e. data written is data read. // else it will blink the LED 5 times in 2 sec interval. // Put something in the eeprom, see .h // flash the test number k = 1; while ( k > 0 ) { LED = on; delay_ms(100); LED = off; delay_ms(200); k--; } delay_s(1); j = eeprom_read ( 0 ); if ( j == 55 ) { LED = on; delay_s(5); } else { k = 10; while ( k > 0 ) { LED = !LED; delay_s( 1 ); k--; } } LED = off; delay_s ( 2 ); // Test 2. This test will test the writing of the eeprom // It will write one byte and read it back. // It will lit the LED when the test passes else it will blink. // flash the test number k = 2; while ( k > 0 ) { LED = on; delay_ms(100); LED = off; delay_ms(200); k--; } delay_s(1); eeprom_write ( 1 , 88 ); j = eeprom_read ( 1 ); if ( j == 88 ) { LED = on; delay_s(5); } else { k = 10; while ( k > 0 ) { LED = on; delay_ms(100); LED = off; delay_ms(100); k--; } } LED = off; delay_s( 2 ); // TEST 3. This test will test the erasing of the eeprom // It will erase the number of bytes given and read it back. // Iy will lit the LED when the test passes else it will blink. // flash the test number k = 3; while ( k > 0 ) { LED = on; delay_ms(100); LED = off; delay_ms(200); k--; } delay_s(1); // First we add another byte to the eeprom to check for eraser overshoot. eeprom_write (2, 0x99 ); eeprom_write (3, 0x5A ); eeprom_erase ( 1 , 2); //it will erase two bytes starting at address 1. j = eeprom_read ( 0 ); i = eeprom_read ( 1 ); k = eeprom_read ( 2 ); m = eeprom_read ( 3 ); if (( j == 55 ) && ( i == 0 ) && ( k == 0 ) && ( m == 0x5A )) { LED = on; delay_s(5); } else { k = 10; while ( k > 0 ) { LED = !LED; delay_s(1); k--; } } // signal end. k = 20; while ( k > 0 ) { LED = !LED; delay_ms(50); k--; } LED = off; // End of Tests. } Enjoy, like I did. With best regards, Frans.
  19. Hi Dave, Oh, I see, some others have been busier than me. :-) I got it finished. Where shal I put it? Frans.
  20. Hi Dave, Pavel, Report of misleading error after compiling. I made a typo in a sub declaration, like this: char eeprom_read(cahr adresa) // read from eeprom The compiler says it is missing the right parenthesis. If you can solve this, that would be fine. With best regards. Frans.
  21. Hi Dave, Thanks, I wil give it a go and let you know. With best regards, Frans.
  22. Hi All, BoostC has a #pragma for putting dat into the eeprom. Does it have functions to read the eeprom? With best regards, Frans.
  23. Hi hvn0005, I am not much of a C programmer, but I can see some mistakes in your program. You declared J to be an int by adding something to it does not change the type, it stays an int unless something is higher in rank than int. You declared X[] to be an array of char to which you want to assign a value of int. The other one I see is in the for statement, the end condition goes to something which is not declared here but hopefully elsewhere. Even if J was declared a char, the sum 226+40 would make 266, which is bigger than a char can hold. I hope this helps. Frans.
  24. You can put any data into rom char*. Use '\' and than a number. For example to put 0,1,2,100,255 into rom use: rom char *ptr = "\0\1\2\100\255"; Regards, Pavel <{POST_SNAPBACK}> Hi Pavel, Yes , that works. The numbers must be decimals. A rather long _get, so if one is in tight ROM then avoid small tables. Thanks for helping me out. With best regards, Frans.
  25. You can't do it in BoostC. Why do you need this? Regards, Pavel <{POST_SNAPBACK}> hi Pavel, Well I need a table in rom. BoostC only supports rom char* text = 'text' unfortunately most of my data can not be translated into text. Then I thought of doing it in asm{} but came upon this HIGH and LOW not recognized by BoostC, but if you look inside the .asm BoostC generates, you see them being there. With best regards, Frans.
×
×
  • Create New...