View previous topic :: View next topic |
Author |
Message |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Tue Dec 07, 2021 10:26 am |
|
|
You should always post a 'link' to the "image2LCD" program/files that you use.
Normally you'll #include filename.c in your program before main()...
Without access to the real programs, I'll make a wild guess that the .h file may contain GLCD setup data and a test picture, while the .c file contains the acutal functions to display it ? |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Tue Dec 07, 2021 4:51 pm |
|
|
Hi, I found this 1024 byte image on internet but I myself convert an image into 128x64 by paint, and then I convert it bmp, obtain a C code but its size being [1030]. So, what I missing, I can't add my own images.
Last edited by Khansokhua on Mon Dec 13, 2021 4:00 am; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Fri Dec 10, 2021 2:41 pm |
|
|
Greetings... I have come. I arranged these imagine issues. Now, I must select pictures and set a time each of them. After that, a button must start the slideshow. Now how am I supposed to handle selection process? I though "While slideshow runs, I can press a button and slideshow stops. Then, I can set appearing image's time on GLCD... "There must be comfortable, practical way to do it. Also, I am thinking this:
Quote: |
The 46K22, is a much better choice. Key 'big thing' is that the PIC18 can
store two bytes per instruction word against the PIC16 only storing one.
Makes the memory even more effective.
On the array, you can have a two dimensional array and pass the
second index to the function, so you can select which index to display. |
Respects
Last edited by Khansokhua on Mon Dec 13, 2021 4:04 am; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Fri Dec 10, 2021 9:19 pm |
|
|
Have a look in the CCS manual, in the 'common questions and answers' section for.
Quote: | How do I wait only a specified time for a button press?
|
You can easily copy/modify this to do what you want.
Display a picture.
Execute the 'timed wait/press'.
If button was pressed,
1) add the picture number to a list to display
2) now choose a display time
Loop until all pictures have been shown.
Now use the list (a 2Darray [picture number, delay time]) to show the selected pictures. |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Sat Dec 11, 2021 7:31 am |
|
|
Step2: After x image selected, each one of image's process time will be set with two segment display (scanning method) by using potentiometer. Then, exit from setting mode.
Step3...
How can I set time with potentiometer? |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Sat Dec 11, 2021 9:26 am |
|
|
I made a 2Darray, int array[8][1024], 8 is index; 1024 is image. Now I can reach the images using index. Should I bring a 7 segment display? Slideshow and 7-segment runs at the same time. So I can press button and it stops. Then I would select the index. If someone will select a image then he/she must see the image ![Very Happy](images/smiles/icon_biggrin.gif) |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9377 Location: Greensville,Ontario
|
|
Posted: Sun Dec 12, 2021 6:39 am |
|
|
Instead of a 7 segment display, I'd use a character LCD module.
It uses the same number of PIC I/O pins, but you can offer the user far more information and control, easily.
These days I only use 4 line x 20 characters LCD modules. While a bit more expensive than the original 2 x 16 units, it's easy to adapt to ALL projects. |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Sun Dec 12, 2021 7:10 am |
|
|
I have to set the time using two segment display with potentiometer. It was required. Thanks. I guess, I must use ADC to level time, right? I made a 0-15 counter which is controlled by a button. Now I will place POT instead of button (I don't know pot's value yet). Then I will start to try something. |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Mon Dec 13, 2021 5:19 pm |
|
|
Hi, I made 0-10 counter with #device ADC=10
but I need 0-15 counter. I read datasheet PIC18F46K22, looked for ADC only 10 bit allows. Then, what should I do ? Respects... |
|
![](templates/subSilver/images/spacer.gif) |
PrinceNai
Joined: 31 Oct 2016 Posts: 507 Location: Montenegro
|
|
Posted: Mon Dec 13, 2021 6:49 pm |
|
|
10 bits means 0 - 1023 |
|
![](templates/subSilver/images/spacer.gif) |
PrinceNai
Joined: 31 Oct 2016 Posts: 507 Location: Montenegro
|
|
Posted: Mon Dec 13, 2021 8:10 pm |
|
|
Your pot can ideally feed from 0V to Vcc to your ADC pin. The ADC readings on that pin can go from 0 - 1023. Divide that into 15 parts and after you read the ADC, see where you are. Each part is approx. 68. So if you read 0- 68, that would be zero for the counter. 69 - 136 would mean 1, 137 - ...
And so on. Maybe more than one read and some averaging, just to be sure. |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Tue Dec 14, 2021 6:45 am |
|
|
The problem is I can just read 10 data(0-10 numbers).Because I can use max 10 bit ADC.So, If I even divided 15 it would be like that 0-3-6-9-11-15-18-21-24-27-30.You see just 10 value, 10 bit.My question is how can I count 0 to 15 one by one, while using 10 bit.What would you suggest? |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19658
|
|
Posted: Tue Dec 14, 2021 6:55 am |
|
|
You are misunderstanding what '10bit' means.
As you have been told a ten bit ADC can return values from 0 to 1023, not
just 0-10.
An 8bit value stores 0 to 255.
A 4bit value stores 0 to 15.
A 10bit value stores 0 to 1023 etc. etc. |
|
![](templates/subSilver/images/spacer.gif) |
PrinceNai
Joined: 31 Oct 2016 Posts: 507 Location: Montenegro
|
|
Posted: Tue Dec 14, 2021 6:56 am |
|
|
I must say I'm a bit lost when you say 10 numbers. It would be nice if you post your ADC setup. 10 bits means 2 on the power of 10, which is 1024, but since it starts with 0, the value you can read is in the range from 0 - 1023, with steps Vcc/1024. What are the binary values you get when you read ADC with the pot turned all the way down and all the way up? You MUST declare a variable you read to as 16 bit. |
|
![](templates/subSilver/images/spacer.gif) |
Khansokhua
Joined: 06 Nov 2021 Posts: 92
|
|
Posted: Tue Dec 14, 2021 7:26 am |
|
|
Sorry, my bad.I just realize that I misunderstood.I can make it also with 10 bit, I can't find out yet.Better if I send code:
Code: |
setup_adc(ADC_CLOCK_DIV_32);
setup_adc_ports(ALL_ANALOG);
...
set_adc_channel(0);
// delay_us(20);
adc_value=read_adc(); // 0-1023
adc_value=(2.5*adc_value/255); //1023/255*2.5=10
output_c(0x01);
birler=(adc_value%10);
onlar=(adc_value/10); |
|
|
![](templates/subSilver/images/spacer.gif) |
|