Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

LCD controller FSM Spartan-3A/3AN FPGA Starter Kit

Status
Not open for further replies.

tomereli

Newbie level 1
Joined
Sep 24, 2010
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,294
Hi,
I am a student and very new to HDL, i have an assignment - writing verilog code for the ST7066U LCD on my board.
I am trying to write a basic FSM which will interface the ST7066U chip.
I have a working example which uses only one always block ( always (posedge clk) ) but from what i've learned so far online and from books, this is a wrong approach and the right one should be using 2 always blocks - one for the combinational part and one for the sequencial part like that:

always (posedge clk, negedge reset)//sequencial part
if(~reset)
....
else
currentState <= nextState;


always (*) //combinational part
case(currentState)
case boot: ...
//delay 40ms is needed here
case init:
...//here i need to plant the initilization routine
...
...


The thing i can't seem to get is how to implement the delays... using the 2 always blocks approach i can easilly decide on the states and outputs, but i don't know how to insert the delays..

Thanks in advance for any help...
 

Hi,
you have to de-associate the FSM itself from the delays between the state transitions.

Calculate the number of clock cycles which correspond to 40ms. Start the counter which
counts this number of cycles at the boot state. Whenever the counter reaches the number
of cycles you are interested in, generate a signal, i.e. counted40ms.
Then use this signal in the FSM combinational part and if you are at the boot state and the
counted40ms signal is raised then go to init state.
Try to keep your FSMs clean and dont push unrelated code into FSM's blocks.

Pavlos
 

I think this would work with slight modifications.
 

Attachments

  • spartan_lcd_config_tuitorial.pdf
    687.3 KB · Views: 160

What u mean with slight modifications?
This project wont run like he is?
thks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top