Probably not. What chip are you using? The 16F628A?Would it not be faster / less processing / resources -- though if I loaded the entire table array into RAM?
It might. I don't think it makes any difference with the dsPICs I've been using, but it might with the PIC16F628 or 877 depending on how program memory has to be accessed for data.Would it not be faster / less processing / resources -- though if I loaded the entire table array into RAM?
They do... http://www.mikroe.com/forum/Does MikroC have forums where you can ask about this?
My gut tells me that it would be faster if straight in RAM. But I did learn something today. I was unaware that it would be so easy to write data straight to program memory. It may come in handy later on for other projects to have hardcoded data in program memory. Particularly if I run out of RAM.It might. I don't think it makes any difference with the dsPICs I've been using, but it might with the PIC16F628 or 877 depending on how program memory has to be accessed for data.
16F877a at the moment for a half a dozen possible notions.Probably not. What chip are you using? The 16F628A?
Absolutely nothing. I know half of C and this is the other half that I do not know.I am still betting that C used program memory. Do you have any examples you have written or used?
Why do you think accessing RAM is faster than accessing program memory for a look-up table?My gut tells me that it would be faster if straight in RAM. But I did learn something today. I was unaware that it would be so easy to write data straight to program memory. It may come in handy later on for other projects to have hardcoded data in program memory. Particularly if I run out of RAM.
Oh my mistake sorry. Been a while since I used the 16F877a. My last project using this MCU was back in 2005. Published in an magazine.Confused...
Why do you think the 877A only has 256 bytes of RAM? Are you talking EEPROM? Why would you want to use that for a look-up table?
View attachment 83143
John
The only tables I have created in mikroC before is for an game of Simon Says and an composite video project years back, which I turned into an clock in the end. A black & white 24Hr clock on your TV screen. Gawd that was tricky to do in C. I had to figure out how long each instruction took to execute.So, do you have any examples of tables you have used to share?
unsigned short simon[32]= {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0};
Back in 2007 I got an high distinction mark of 95% for an assignment in Excel at University. So long ago and I have forgotten it all.Now, I have been forced to use Excel.
Forget making a DIY DAC with resistors, it's a waste of time and won't get you much better than about 6 bits of accuracy, even if you use 0.1% tolerance resistors.So...
- PORTB Output to R2R Ladder 8-Bits
- Buffer with Amplification Output of Ladder with Adjustable Amplitude using Pot
- Filter Output (butter worth filter)
- Feed to OPAMP with Variable DC Offset Adjustment using Pot
- Set Impedance of Output to 50 Ohm
Interesting. And it would make the project more original, since most of the DIY hobby DDS projects I have seen use an R2R ladder for the DAC. But the interface is serial for the MCP4801. It would be faster to have an 8-bit parallel interface. I can dump a byte of data to PORTB quite fast in C. Hoping to get at least 100KHz of bandwidth.Forget making a DIY DAC with resistors, it's a waste of time and won't get you much better than about 6 bits of accuracy, even if you use 0.1% tolerance resistors.
Use a proper DAC, like the MCP4801:
http://www.microchip.com/wwwproducts/Devices.aspx?product=MCP4801
I need to use original circuits, source code and artwork developed from scratch. Otherwise there will be little interest in the project.Alternately you could use the 4015 IC shift register and filter for producing a very good sine wave. This simple circuit would need a clock source and the MCU PWM output could be used to make it frequency controllable.
I recently made a circuit that has a PWM clock to a 4015 and a bandpass filter to create an AC signal.
This method frees up MCU resources and gets a very reliable signal. Google "4015 sine wave generator" and check the images. It will also need an appropriate filter low pass or band pass at the required frequency.
Al
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
Generating a 38kHz Sine Wave | General Electronics Chat | 9 | ||
V | generating sine wave | Microcontrollers | 6 | |
P | Generating High Resolution Sine wave Using PIC's PWM | Microcontrollers | 4 | |
P | Generating 10kHz sine wave signal by PIC and DAC IC | Microcontrollers | 17 | |
E | generating sine wave | Analog & Mixed-Signal Design | 24 |
by Robert Keim
by Don Wilcher
by Duane Benson
by Aaron Carman