Guest AtomSoft Posted August 11, 2011 Report Share Posted August 11, 2011 Hey i ordered my papilio one from CuteDigi hope you dont mind... I did my first projects: http://www.electro-tech-online.com/microcontrollers/120525-fpga-12.html#post996655 and second: http://www.electro-tech-online.com/microcontrollers/120525-fpga-12.html#post996698 i also implemented the AVR soft core with a custom peripheral which has 4 registers.. 3 control (RATE) registers 1 Status register Internally there is a 24 bit rate register which pulls in data like: rate_reg(23 downto 16) <= control_reg; rate_reg(15 downto <= control2_reg; rate_reg(7 downto 0) <= control3_reg; I wanted to know can i simply create a 24 bit register to write directly to ? Link to comment Share on other sites More sharing options...
Jack Gassett Posted August 11, 2011 Report Share Posted August 11, 2011 The projects look good and I don't mind you ordering from CuteDigi at all. I wanted to know can i simply create a 24 bit register to write directly to ? Can you elaborate more on what you want do to do? The I/O bus is 8 bits wide from what I remember so you can implement a 24 bit register but need multiple reads or writes to access it. I'm not sure if that is what you were asking though. Jack. Link to comment Share on other sites More sharing options...
Guest AtomSoft Posted August 11, 2011 Report Share Posted August 11, 2011 Thanks, thats what I have done. I setup 3 8 bit registers and then just merge them into one 24bit ... which is fine anyway... Ok i have a question, I have like no experience with Arduino type code so wanted to know.. Can i implement a register and be able to set a bit at a time without having to set the entire register? Like in PIC micros i can: LATA = 0x01; // This sets the entire port output latches to 0000 0001 What i want to do is more like: LATAbits.LATA0 = 1; //This just sets BIT 0 to a 1 How would i do this in Arduino ? Can i give the bits nice names ? Basically i am going to try and make a LCD Peripheral for the AVR softcore and wanted to make a control register where each bit has a specific purpose like CONTROL REG - BIT 7 = LCD CS Control BIT 6 = LCD RS Control BIT 5 = LCD WR Control BIT 4 = LCD RD Control BIT 3 = LCD RST Control BIT 2 = LCD BACKLIGHT Control BIT 1 = ....To come later BIT 0 = ....To come later How can i make it so i can simply use the arduino style... ControlReg.CS = 1; //Something like this... Link to comment Share on other sites More sharing options...
alvieboy Posted August 12, 2011 Report Share Posted August 12, 2011 Hi, See the AVR bit manipulation instructions for this (SBI/CBI). For IO you can also toggle individual bits. From ATMEGA48/168/328 datasheet: 13.2.2 Toggling the Pin Writing a logic one to PINxn toggles the value of PORTxn, independent on the value of DDRxn. Note that the SBI instruction can be used to toggle one single bit in a port. Álvaro Link to comment Share on other sites More sharing options...
Guest AtomSoft Posted August 12, 2011 Report Share Posted August 12, 2011 Thanks a ton, i might use that and define the bits as names before hand Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.