Jump to content

ra68gi

EstablishedMember
  • Content Count

    229
  • Joined

  • Last visited

Everything posted by ra68gi

  1. Hi, I think we need to know how you generate the zero cross pulse. Try to use a full wave rectifier ckt with a center-tap transformer in which case you use only 2 diodes to do the rectification. Use a low drop diode like germanium instead of silicon diode. Silicon diodes create a 0.7v drop. Generate a narrow pulse with comparator setup. you can use the rising edge to activate the interrupt. Make sure your sine signal is symmetrical on both the +ve & -ve cycle. See if using rising edge for one & falling edge for the next as interrupt triggers solves your problem. Regards Raghunat
  2. See in Thermometer1.c Programming PIC micro for beginners Regards Raghunathan Where's the SPI in that file? Dan, I recommend you read the data sheet for your device because it walks you through the steps to take for SPI and it's fairly easy. The functions you might need to write are very simple. Easier than implementing I2C. Post again if you have problems and we'll help you out. Hi, SPI or serial peripheral interface is a communication protocol. Its a synchronous communication protocol, because it uses a clock to send or receive data. This is unlike the RS232 communication a
  3. See in Thermometer1.c Programming PIC micro for beginners Regards Raghunathan
  4. I couldn't find anything. But SPI is so simple with the device itself that you really don't need it. It's easier than I2C. Maybe some other users could provide links to threads in this forum or elsewhere to sample code. The search feature is useless for this (and many other things) because of the 4 letter minimum search terms. I did a bit of research and found some info that suggested that SPI and I2C are very similar, to the extent that an SPI device can actually reside on an I2C bus, as long as you provide an additional enable line. A little more work needs to be done to confirm t
  5. Sree, You can build this program in the sourceboost IDE and check how the code gets executed using the debugger/simulator. You can also see the Special function reg- gisters & their values change while stepping thro' the code. Especially watch the tmr0 register and intcon register. 1) The register that contols tmr0 is the option register. learn more about it by down loading the datasheet of your chip from microchip.com 2) Its interrupts are controlled by the bits 5 & 7 of the intcon register(also in datasheet). 3) Its interrupt flag is activated by bit 2 of intcon register. 4
  6. Apostal, Generally the output of the IR RX would be a series of pulses rather then a high or low. Its best recommended to measure the number of low( assuming the output of the IR receiver goes low on detecting an object) This can avoid false triggers & providing a sort of hysterisis to the circuit. So its better to do a software polling. The polling can be done for just a brief period by switching on the ir tx and then switching it off. Just a burst of pulses will do. A continuous pulse train from the IR LED(TX) will be viewed as noise by your RX and it shuts down. You can use an in
  7. Thats great news! I would definitely buy it. Regards Raghunathan.
  8. Hi Dave & Pavel, Its been a long time since the introduction of FP in BoostC. When will we have trignometric functions, exp, log, sqrt, pi ...etc in boostc ? Regards Raghunathan.
  9. How much does it cost or is it free ? Regards Raghunathan.
  10. Dave & Pavel How long do we have to wait for a usb lib? Regards Raghunathan.
  11. Are you talking about rs232 communication? Source boost user manual has got lots of string handling functions. have a look at them Regards Raghunathan
  12. I have used the PWM in PIC16F72. You may have to sightly modify for the PIC18. It generates a 38khz for IR communication as carrier frequency. #include <system.h> #pragma CLOCK_FREQ 20000000 // config clock to 20mhz. // Set configuration fuse. #pragma DATA _CONFIG, _HS_OSC & _WDT_ON & _CP_OFF & _PWRTE_OFF void main(void) { trisa = 255; trisb = 0; trisc=0; //set all portc pins as output pins. portc=0; //make all portc pins low. option_reg = 0b11111111; // using 1:32 prescaler for wtd. //wtd will awaken from sleep mode.wtd uses internal rc for its clock. //wtd gives
  13. could be syntax problem with your rom char array statement. I have made programs for digital sine wave generation. have a look at the program. with a r-2r ladder (dac) connected to portb you can generate a sine wave.Hope it helps. #include <system.h> #pragma CLOCK_FREQ 4000000 // config clock to 4mhz. // Set configuration fuse. #pragma DATA _CONFIG, _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF unsigned char get_sine_value(unsigned char x) { rom char *sine_array = {0,2,3,5,6,8,9,11,12,14,16,17,19,20,22,23,25,26,28,30,31,33,34,36,37,39,40,42,43 ,45,46,48,49,50,52,53,55,56,
  14. Many a times we need to read a SPI device(serial pheripheral interface) by giving clk pulses and receiving the data serially. We would store it in some variable. I have written a program to access 20bits from a serial ADC ads1230. The section of the code looks like this.. void interrupt( void ) { unsigned char b; //data ready interrupt from ads1230 if(intcon.1) //RB0/int(falling edge signal from ads1230 drdy pin) { l_adc_counter = 0; l_clk(); l_adc_sign_flag = portb.0; // 20th bit(MSB) is the sign bit. for(b=0;b<17;b++) { l_clk(); l_adc_counter |= portb.0; //load th
  15. Hi John, If i understand it right, I think you are wanting to measure the frequency of a square wave signal. There are many ways to do it. You could use the ccp module in the capture mode to captue the tmr1 value every time a rising edge is received in your ccp pin. If your time period is larger than the 16 bit timer counter then you need to also count the tmr1 over flow interrupt. I have done a similar program using timer1 & ccp pin, but i have used the ccp pin only as a pin to detect the external pulse interrupt & not in the capture mode. Sorry, I don't have time to explain my c
  16. Hi emte, Infact one can generate any odd Baud rate using the formula Baudrate = Fosc/16(x+1); where x is the spbrg value or divisor value, but we would like to use baud rate that are supported by the com ports in our PC. 33.6kb is not supported my hyper Nor my VB supports it nor does the terminal of source boost ide. Regards Raghunathan.
  17. Hi Guys, I am using the huart of the 16F877A with a 20Mhz crystal. I wish to use the transmission with the highest baud rate possible supported by the hyper terminals com port at the same time want a very reliable transmission. I also know that only for certain baud rates the divisor value creates minimum percentage error as can be seen in data sheet. So I am using it at 19200 bauds with a percentage error of 0.16. What would be the maximum recommended or worst case error value for reliable communication? At 38400 baud the divisor of 31 generates an error of 1.6%. At 57,600 with a divisor
  18. Hi Ettore, Yes, as you say 7135 chip is quite a old chip but looking at the cost(less than a dollar in my place) performance & ease of interfacing ( DIP package) its still worth it. There are a lots of delta sigma adcs with 24 bit resolution & nearly 1k plus samples thro' put available at low price especially from cirrus logic. I started with 7135 because its relatively easy. I have right now developed the same circuit with ADS1230 20 bit adc from texas instrument. This has a thro'put of 80 samples per second.These chips have builtin amplifiers and come in smd pack making the whole ck
  19. Hi David, I have not used this chip, but looks like this chip has got a lot of oscillator options. Your option in the pragma statements shows that you have chosen internal RC oscillator mode and no pin is made to out the clock,ie. to say both osc1 & osc2 pins are made as i/o pins. I think you need to set the osccon register for it to function. Look into the data sheet & load the appropriate bits on to the osccon. osccon = 0b???????? ; regards Raghunathan.
  20. Hi emte, Nice to see you back in the forum after a small gap. Well, i suppose you are not impressed with my project . Hey man.. atleast give me a word of motivation. I am not going for a competition nor am I trying to sell some thing, I am only sharing my experience in constructing this project. Let me see if you would change your mind once i have posted all the project stuff. I had gathered these information with great difficulty & I am sure its going to benifit many. note: The project has got nothing to do with pogo pins. Info on UTM:UTM Zwick UTMs Regards Raghunathan.
  21. Dear friends, At last my project is ready to be posted on this forum. I made this project for my UTM(universal testing machine). An UTM is used for materials testing. Its used in several industries, especially in automobile industry( to test materials like springs, axles, cables. etc) for their durability. This project is fairly large & so I will divide it into many sections or parts. Though a difficult project for a beginner, I have made all efforts to furnish all the required details of the project so that it will be easy for any one to reproduce. This project will not only be interest
  22. Thanks, Picxie for clearing my doubt. Raghunathan.
  23. I am working with the husart lib functions of the BoostC. The section of the header file rs232_driver.h looks like this... if (T_MODE & USART_HW) { while (!KBHIT<_USART_TEMPL_ARGS>()) // wait for a character if (T_MODE & USART_reset_wdt) clear_wdt(); return(l_rcreg); } I have generally used the while function ending with a semicolon like this.. while (!KBHIT<_USART_TEMPL_ARGS>()); // wait for a character or if you have some statement to execute.. while (!KBHIT<_USART_TEMPL_ARGS>()) // wait for a character { .... .... } I don
  24. I am sorry, for PIC16F690 you need to use the ansel register to set or clear analog functions on porta pins. For chips like 16C620,621,16F627 & 628 use comcon = 7 ; to use porta pins in digital mode. For chips like PIC12C67x, 16C7xx, 16F87x use adcon1 = 7 ; to use porta pins in digital mode. Regards Raghunathan.
  25. RAM is volatile ie. the data gets erased when power is gone. Not the one you are looking for i guess. external eeprom is the most economical option using I2C interface. Regards Raghunatahan.
×
×
  • Create New...