CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

PIC16F877A with GLCD (HDM64GS12 with KS01108)
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Dec 07, 2021 10:26 am     Reply with quote

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 ?
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Tue Dec 07, 2021 4:51 pm     Reply with quote

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
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Fri Dec 10, 2021 2:41 pm     Reply with quote

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
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 10, 2021 9:19 pm     Reply with quote

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.
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Sat Dec 11, 2021 7:31 am     Reply with quote

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?
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Sat Dec 11, 2021 9:26 am     Reply with quote

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
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Dec 12, 2021 6:39 am     Reply with quote

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.
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Sun Dec 12, 2021 7:10 am     Reply with quote

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.
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Mon Dec 13, 2021 5:19 pm     Reply with quote

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...
PrinceNai



Joined: 31 Oct 2016
Posts: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Mon Dec 13, 2021 6:49 pm     Reply with quote

10 bits means 0 - 1023
PrinceNai



Joined: 31 Oct 2016
Posts: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Mon Dec 13, 2021 8:10 pm     Reply with quote

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.
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Tue Dec 14, 2021 6:45 am     Reply with quote

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?
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue Dec 14, 2021 6:55 am     Reply with quote

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.
PrinceNai



Joined: 31 Oct 2016
Posts: 452
Location: Montenegro

View user's profile Send private message

PostPosted: Tue Dec 14, 2021 6:56 am     Reply with quote

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.
Khansokhua



Joined: 06 Nov 2021
Posts: 88

View user's profile Send private message

PostPosted: Tue Dec 14, 2021 7:26 am     Reply with quote

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);
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group