Jump to content

ra68gi

EstablishedMember
  • Content Count

    229
  • Joined

  • Last visited

Everything posted by ra68gi

  1. Tim, If u need to connect more than one LCD to ur mico connect them in parallel & multiplex them using some thing like using chip-select pin. Only one driver file can be used. May be u need to write ur own driver to support parallel devices working on different i/o pins. Most spi device will have chip-select pin. connect all devices in parallel(in, out & clk)& use different i/o pins for multiplexing the chip-select pin. Regards Raghunathan.P
  2. Hi, Have u not tried the picpack lib(pic_serial.c)? I tried it with 2550 & it works. Its such a waste of time trying to make a virtual serial port from ur usb device. USB is used for hi speed communication & u can make HID class device thro' which u can transfer data at a rate of 40-50 characters per millisecond. Sending variables from pic to PC is so easy using the HIDMAKER tools from tracesystem. try this out... http://tracesystemsinc.com/all-usb-product...ucts-alias.html Regards Raghunathan.P Edit : Sorry Harris I did'nt realise this was a very old thread.
  3. Long time ago I had asked Dr.Bob(Robert Miller) of Trace Systems if they could integrate BoostC compiler. I think Pavel & Dave should decide on this. HIDMAKER32 is shortly expected & they will support most USB microcontrollers from the 8bit to 32bit device. Regards Raghunathan.
  4. Hi, for all those who find USB difficult can try a simpler way of implimenting USB in ur PIC projects. http://tracesystemsinc.com/all-usb-product...ucts-alias.html Dave & Pavel, it will be nice if BoostC can be integrated in HID maker. Regards Raghunathan.P
  5. Hi Joli, acquiring 24bit signed data & storing it in 32bit signed can be a bit confusing. My approach is like this.. First I test if its MSB(24bit signed) is a 1. If its 1 then its a signed data. I store the rest of the bits in our normal 32bit(long) unsigned type. Then on the long data I do a 2's compiliment. finally to get the signed 32 bit data, I multiply it with -1. Here is an example done on 18bits of data. The rest of the adc bits where purposefully truncated. u can modify the code for 24bit signed. unsigned long adc_counter, adc_counter1; signed long adc_buff1; if(adc_di
  6. 24 bit floats ?? Regards Dave Some ADCs store the adc results (24bit) in signed 2s compliment format. The datas are usually sent out via SPI. In such case a it can be a little helpful if we could directly load the value into such data types. Regards Raghunathan.P
  7. Hi Dave, When can we expect the next release of Source Boost IDE? Will the the above device be included in the target device drop down menu? I have not yet down loaded the beta2 version. Regards Raghunathan.P
  8. Dear sir, Please allow me to differ with you here. I think its the time which becomes half of the total ccp. So the freq would be double. Please correct me if I am wrong as I am a novoice. I still think that the CCPR1L's value must be half of the value of period register value in order to get a 50% duty cycle. Am I wrong? Further more I was just wondering whether the ECCP o/p keeps on running in background, allowing me to do any other jobs with my pic (like continously monitering the adc channel, making some ports high or low etc?) Thanks for your efforts and support Regards Shree
  9. Shree, The PWM output at the ccp pin is designed for 100hz and the two out of phase pulse generated in the ISR will have half the freq of the ccp pin ie.50hz. Now the pulse out at the ccp pin can have 0 to 100 % ON time by loading the ccpr1l & ccpr1h. This ccp pin pulse has to be ANDed with the 50hz pulse generated in the ISR. Then As the duty cycle changes from 0 to 100% in the ccp pin the 50hz pulse in ISR(RB0 & RB1) will vary from 0 to 50%. A graphical representation will make things better to understand. Try if u can figure out from the above information. Regards Raghuna
  10. Hi Shree, I don't know about your code, but I can tell u how the PWM module works. First there are three important registers associated with it. they are 1) tmr2 or timer2 register 2) pr2 register also called the period register. 3) ccpr1l & ccpr1h which holds the 10bit duty cycle value. a)PWM generates a square wave form output at the ccp pin. b)Any square wave form has an ON time & OFF time. c) The ON time is called the duty or duty cycle. d) One ON time plus one OFF time is called the period or T. Frequency of the wave form is f = 1 / T . e) The ON time is decided by th
  11. I think we don't have. You can make your own function. I have a sample code made long back. see if it can help u. Its made for PIC16F72, 1mhz RC clock. #include <system.h> // Set clock frequency to 1MHz. #pragma CLOCK_FREQ 1000000 //set configuration fuse. #pragma DATA _CONFIG, _RC_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF int duty_cycle; //global variable /*Interrupt service routine (ISR).On timer2 interrupt, program will jump to this code location. */ void interrupt( void ) { char pulse; /*generate two 50hz 180 degree out of phase pulses & externally AND it wit
  12. Well if they have a time/resource constraint, I would prefer they concentrate on getting a compiler for the 24bit device. Regards Raghunathan
  13. Thanks to Dave & Pavel, The 16F1937 is very attractively priced, so planning of using them in my new projects. Regards Raghunathan.
  14. Hi Dave, Do you intend to support the 16F193X series devices ? If so How soon? Regards Raghunathan.
  15. Hi, There are some issues when u have your argument as pointer. declare the pointer as char *n as in the above case.. signed long adc_deci ( char *n) { signed long m; m = 0; m += *n++; m += *n++ * 10; m += *n++ * 100; m += *n++ * 1000; m += *n++ * 10000; if(adc_sign_digit==0) { m = m*(-1); } return m; } I have a doubt here??? I think its ok to pass a string in the calling function & u need to check the null character as the terminator. Like the simple putc function void putc(unsigned char tx_char) { while(SSR0_TDRE == 0); TDR0 = tx_char; } void puts(char *source) { whi
  16. bit adc_sign_digit; signed long adc_deci (unsigned char n[]) { signed long m; m = 0; m += n[0]; m += n[1] * 10; m += n[2] * 100; m += n[3] * 1000; m += n[4] * 10000; if(adc_sign_digit==0) { m = m*(-1); } return m; } void main() { unsigned char adc_bcd[5]; while(1) { if (portd.6 == 0) //if tare. { tare_value = adc_deci(adc_bcd); } } } Regards Raghunathan
  17. Hi Reynard, Its not called preload register but period register. timer2 is used for the pwm module & its value is compared with PR2 register and the duty cycle value( stored in a crazy way in the PIC). One can activate the interrupt for tmr2 PR2 match. Regards Raghu.
  18. Hi Trossin, I disagree that you can't get accurate timing with tmr0. As of the crystal error is concerned you may be right. But every one uses a crystal. The sample code I had given in the thread "programming pic micro using boostc" is correct. I have checked it up using mplab stopwatch. And I have used it as a real time clock & it works fine. Build the program in mplab sim, make a break point in the first line in the ISR, reset the stop watch on the first interrupt & run it several times & you will see that the stop watch show 250us every time. The code tmr0 +=9 ; is all you n
  19. Hey Sree, Once you enter into a while(1) loop in the main, don't get out off it. Why do you go back to initializing the ports. I would suggest not to use goto. If u are using flags then there is no need to use goto. Regards Raghunathan
  20. Hello Mr. Raghunathan, If you see the code, the interrupt and eeprom functions never occur toeghter. Besides there is always 1 second more in every minute. I dont know why. Regards Shree Well, if the eeprom write & read are not called while your timer/ interrupt is activated, there could be some other problem. you can probably check the timing on the mplab simulator using stop watch. Make your global variable dist as signed int. since you keep decrementing its value in the ISR. it may take negative value. use while(dist>0) or while(dist>-
  21. Hi Sree, I didn't have time to go through your code. I think the eeprom read & write functions disable the interrupts while writing & reading. May be that could be one reason why your timing is not accurate. Regards Raghunathan.
  22. Currently I am using the STX command as a qualifier, then placing the data into my array after that. I really don't think that part is my issue now, but I will note that and try it if the crystal doesn't provide any improvements. Thank you for your suggestions. I would suggest u use the builtin function of the sourceboost to begin with. Some times I do face problem with data parsing. The data stream should be sent at the same rate( mind u this is not the baud rate). If there is a change in the data stream rate( say from 10characters/s to 20char/sec) then chances are there that some
  23. hi, for your serial receive program, u can use the space as the qualifier & start loading the other digits in an array. The size of the array depends on the data digits lenght. try placing full-load to the indicator determine the data length. I thought it should display 00001828 on the hyper. Regards Raghunathan.
  24. Hi, I suppose u can connect a load cell to your indicator. connect it & see if the count value changes on the hyper-term when you press the load-cell. Right now what we see on the screen must be just raw counts. we need to config & calibrate the device. I probably would require the whole data sheet to do that. regards Raghunathan.
×
×
  • Create New...