![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
Hey all i wanted to know something.... You know how you can Set a Byte or better yet PORT and then set individual bits like LATA = 0x01; or just LATAbits.LATA0 = 1; How can i create my own varriable like that? If i wanted to name it... MyCon and use it like : MyCon = 0x01; MyConbits.Con0 = 1; How can i do that/this? Im going to look through the headers and see if i can figure it out but if anyone knows off the top of head plz & thanks
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 26th November 2008 at 12:42 AM. | |
| |
| | #2 |
|
Would i have to make: Code: extern volatile near unsigned char MYCON;
extern volatile near union {
struct {
unsigned CON0:1;
unsigned CON1:1;
unsigned CON2:1;
unsigned CON3:1;
unsigned CON4:1;
unsigned CON5:1;
unsigned CON6:1;
unsigned CON7:1;
};
} MYCONbits;
Got It: Code: union{
unsigned char mycon;
struct {
unsigned CON0:1;
unsigned CON1:1;
unsigned CON2:1;
unsigned CON3:1;
unsigned CON4:1;
unsigned CON5:1;
unsigned CON6:1;
unsigned CON7:1;
};
} MYCON;
then
#define MyCon MYCON
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 26th November 2008 at 12:25 PM. | |
| |
| | #3 |
|
The use of MyCon MYCON and mycon in your example is a potential source of confusion. Here is an example from my code for LCD handling. Code: union {
unsigned int all;
struct {
unsigned reset:1;
unsigned rs:1;
unsigned rw:1;
unsigned enable:1;
unsigned data:8;
} bits;
} lcd;
...
lcd.all <<= 1; // shift entire lcd
lcd.bits.reset = 1; // set reset bit
lcd.bits.enable = 0; // clear enable bit
Code: union {
unsigned int all;
struct {
unsigned reset:1;
unsigned rs:1;
unsigned rw:1;
unsigned enable:1;
unsigned data:8;
};
} lcd;
...
lcd.all <<= 1; // shift entire lcd
lcd.reset = 1; // set reset bit
lcd.enable = 0; // clear enable bit
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | |
| |
| | #4 |
|
Awesome!!!! I wanted this for my GLCD actually because i will be using 2 shift registers 1 for data and 1 for control lines. And i wanted to make a structure i can set easily and just shift out afterward to avoid confusion. Thanks again!
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #5 |
|
Glad to help. I have yet to play with the GLCD's. Is there a reason you do use a single shift register for both? 3v0
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | |
| |
| | #6 |
|
The GLCD i use is Parallel and has about 13 lines which need to goto the PIC. I use 2 8 bits and have some unused but its better than 13 used pic pins. It will cost 4 pins to use the 2 registers but i save like 9 pins then which is very good to me lol GLCDs are fun but getting an image on them is a hassle. I think a TFT LCD would be simpler lol
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #7 |
|
Im Using a AGM1264F which has a ks0108 on it. I think 2 one for left side and one for the right side. OFF TOPIC: Damn i think i got a virus. Im going to be gone for some hours (going to reinstall windows). Hopefully i dont forget to re-install something needed
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 26th November 2008 at 07:18 PM. | |
| |
| | #8 |
|
What shift registers are you using. Most often I use 74xx595's which can be cascaded. Without any trickery to reduce the number of lines it looks like this.
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) | |
| |
| | #9 |
|
Im using SN74LS164's and from what i can tell i cant link them. I just came home and finished reinstalling almost everything i have to reinstall adobe acrobat so i cant see that PDf as of yet but will soon.
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #10 | ||
|
I was thinking you should be able to so I looked around EE Design - Technical - Expanding Outputs using the 74LS164 Shift Register Quote:
Quote:
EDIT: I could have posted the eagle file and saved you system reloading work.
__________________ Please post questions to the forums. PM's are for personal communication. BCHS/3v0's Tutorials Junebug USB PIC programmer kit., USB Bit Whacker, The 15 Minute Printed Circuit Board! (+drill time) Last edited by 3v0; 27th November 2008 at 01:44 AM. | |||
| |
| | #11 |
|
Im using SN74LS164's and from what i can tell i cant link them. I just came home and finished reinstalling almost everything i have to reinstall adobe acrobat so i cant see that PDf as of yet but will soon.
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #12 | ||
| Quote:
From the link 3v0 gave you: Quote:
The Quintessential PIC Microcontroller how to connect 74ls164 chips in cascade for running leds schematics Last edited by BeeBop; 27th November 2008 at 07:37 PM. Reason: link added | |||
| |
| | #13 |
|
Wow thanks! Im having some huge ISP issues right now. Ill have to read it in a minute. Thanks again
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics | |
| |
| | #14 |
|
forgot to say i used 3v0 link NICE! thx and Beebop thx for link im reading it now i know what a delay lol thanks guys you all rock!
__________________ AtomSofts eBay Store AtomSoftTech: C18 TIPS & TRICKS v9 PDF Nokia 6100 Driver/Software My Name: Jason Lopez http://atomsofttech.info/ | My YouTube Videos! My Favorite Store: dipmicro Electronics Last edited by AtomSoft; 8th December 2008 at 04:23 AM. | |
| |
| | #15 |
| | |
| |
|
| Tags |
| byte, c18, structure |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| LCD+keypad interface -> menu structure. Concepts sought. Assembly. PIC. | astronomerroyal | Micro Controllers | 23 | 29th August 2008 04:59 AM |
| Urgent help needed ! Structure for project | rngd | General Electronics Chat | 7 | 8th March 2008 06:20 PM |
| Programming structure in C | demestav | Micro Controllers | 8 | 12th May 2007 04:37 AM |
| How to initialize CCS static structure | janetsmith2000@yahoo.com | Micro Controllers | 1 | 6th March 2004 04:09 PM |
| Basic structure | Win32_under_the_API | Micro Controllers | 1 | 2nd September 2003 05:13 PM |