Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Recently I've started implementing CHIP-8 emulator in C. After implementing most of the opcodes I've faced a problem of implementing display for my emulator. After some googling and reading I've decoded to give OpenGL a shot. And here's the problem - display information is stored as a 1 bit per pixel monochrome image in the last 256 bytes of CHIP-8 memory (memory is an uint8_t array of size 4096). Of course, I can create another array for storing display data in a more usable format (1 byte per pixel) and render it via OpenGL as a texture, but what I want to know is if there are more elegant and efficient solutions in modern OpenGL or others libraries/frameworks which can be used within the C programming language.
Thank you in advance.
P.S. English is not my mother tongue so error fixes would be appreciated.
With modern OpenGL you can use integer textures and use a 8 bit single channel image format. Then in the shader you divide the fast running coordinate by 8 to determine the texel and the remainder to select the bit, something like this in GLSL
texelFetch(texture, ivec2(texcoord.x/8, texcoord.y), 0).x &
(1 << texcoord.x%8) != 0;
I'm currently on mobile, so please excuse if this is too concise. If you need more details, ask for it!
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 days ago.
Improve this question
It might be an stupid question since im starting with C. But as the title say im trying to get the LCD to read the data (temperature and humid) from the DHT. The problem is that in the library im using the first one read just uint8 and the second gives int data.
I tried to transform the DHT11 data using "uint8_t temperatura = (uint8_t) temp;" but it doesnt seem to be working since the LCD just gives random symbols.
I dont know if that kind of transformation from int to uint8 is too "rusty" so the program is not doing a good work, or the most probably thing that im messing it up in someway.
Im using the UNO kit with an atmega328p.
Anyway, i would appreciate the guidance or suggestions!
Edit: I wasn't able to post the code with the format required so i'll leave it in a picture:
https://i.stack.imgur.com/u57od.png
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I want to plot a graph for fidelity with respect to time.
My function is
Here F is fidelity and consider alpha = sqrt of 5.
How to plot this?
Can you give me some model programming code and recommend me some online site for plotting this?
Plot Online (wolframalpha.com)
When it comes to programming, that depends on the desired output. This could be only the screen (gdi, directx, opengl), raster graphics (bmp, jpg, png, ...) or vector graphics (svg, gltf, ...).
But before you (can) put anything out, you would have to calculate the plot points first. Here you definitively need the standard math library (math.h).
Once you have your set of points, you could plot them by using additional software like plotutils.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
http://www.tech.dmu.ac.uk/~eg/tensiometer/fft/fft.c
http://www.tech.dmu.ac.uk/~eg/tensiometer/fft/fft_test.c
I have found a good working C Code for FFT Algorithm for converting Time Domain to Frequency Domain and vice versa in the above links. But I wanted to know the flowchart or step by step process of how this code works. I am trying to analyze the code with butterfly method of decimation in time for FFT but i am facing difficulties in understanding the code. The code is working very well and giving me the correct results but it would be very helpful to me if someone could give a brief or detailed explaination on how this code works.
I am confused with the array and the pointers used in the fft.c code. Also I am not getting what are the variables offset and delta mean in the code. How the rectangular matrix of real and imaginary terms are considered/used in the code?? Please guide me.
Thanks,
Psbk
I strongly recommend to read this: https://stackoverflow.com/a/26355569/2521214
Now from the first look the offset and delta is used to:
make the butterfly shuffle permutation
you start with step 1 and half of the interval
and by recursion you will get to log2(N) step and interval of 1 item ...
+/- one recursion level
I usually do the butterfly in reverse order
The XX array
is a buffer to store the subresult or input data
you can not perform FFT inplace easily (if at all)
so you compute to/from the temp buffer instead
and on each recursion just swap the data and temp buffers (physically or their meaning)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm a beginner in the embedded field. I have done a few engineering project using ARM and PIC micro controller. Now I'm facing a problem how to store some details(like name and rate) in the non volatile memory or external memory? Can any one help me to solve this? Fom where I should get examples of this storing? Now am using keil u vision 4 for programming but printf is not working in it? Earlier I'm using keil u vision 3 printf was working on that?
Various controller families have such things as EEPROM, or modifiable Flash. But they are accessed in a completely controller-dependent way.
To use them, you just issue a command (or rather set of commands) to store data X to address Y in this memory area. Later on, you get them back.
How this is done should be obtainable from the manual and/or application notes from the manufacturer of the chip.
Also be aware of the timing. AFAIR, a PIC needs 4 ms to store a single byte, so it might be helpful to set up (or use) a framework which automatically stores data byte for byte and advances upon receipt of an interrupt. So the work is done in the background.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am bit new to programming and i want to send a float data to eeprom from a controller and i want to implement crc for the error detection of the data when ever i tries to read or write.
This is my intention.But i found many algorithms for implementing crc and its been quite confusing for me to follow which one.
The compiler provides 4 bytes of space for all data and its function sends each byte one at a time.So i trust i would be required to do the crc of each 8bit data or can implement it as a whole.
And i am using C language.
In brief:
i just need to do a
1.Crc implementation.
2.Common Data size =32 bits
3.Compiler function sends one byte at a time.
4.And how do we fix which algorithm to go for.
Thank you very much
Try Reading this article(It Contains C Codes and Diagrams Which you need) :
http://www.barrgroup.com/Embedded-Systems/How-To/CRC-Calculation-C-Code
CRCs are among the best checksums available to detect and/or correct errors in communications transmissions. Unfortunately, the modulo-2 arithmetic used to compute CRCs doesn't map easily into software. This article shows how to implement an efficient CRC in C.