- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to read the output of a analog sensor. So is it possible that i can connect directly that sensor with my FPGA board or i have to use arduino. if i have to use arduino then how i can interface with it. thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can't connect an analogue sensor output signal directly to an FPGA - you will need an ADC. Depending on the sensor you're hoping to use an Arduino board could be used.
Cheers,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using digital sensor TCS230. If you can provide me some sample code that how i can read or write on that sensor using my FPGA board I/O pins. Below is the link of my sensor and i am using DE10-lite FPGA board. Thanks @a_x_h_75
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Post any code you're having trouble with (I'm not writing it for you) and we'll help.
Cheers,
Alex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is my code and still i got no success. Plz help me . Thanks
module test1
(
input fr,en,clk, //input light value
output reg M1, M2, M3,s2,s3,
output s0,s1);
//parameter frequency = 1'b0;
//setting frequency-scaling to 20%
//states
assign s0 = 1'b1;
assign s1 = 1'b0;
reg [15:0]count,count_next;
reg [15:0]counter,counter_next;
wire [20:0]interval;
reg [20:0] interval_next;
wire [15:0] div;
always@(*)
if(interval=='d24000)
begin
s2<=1'b0; //red
s3<=1'b0;
end
else if(interval=='d48000)
begin
s2<=1'b0;
s3<=1'b1; //blue
end
else if(interval=='d96000)
begin
s2<=1'b1; //clear
s3<=1'b0;
end
else if(interval=='d120000)
begin
s2<=1'b1;
s3<=1'b1;
end
always@(posedge clk)
if(interval <='d120000)
interval_next = interval+1;
else
interval_next = 0;
assign interval = interval_next;
always@(posedge clk)
if(div < 'd4545 && en == 1'b0)
count_next = count + 1;
else
count_next = 0;
always@(posedge fr)
if(div < 'd4545 && en == 1'b0)
counter_next = counter + 1;
else
counter_next = 0;
assign div= count/counter;
always@(*)
begin
M1=0;
M2=0;
M3=0;
if( (div >= 'd3125) && (div <= 'd2083) && (s2 == 0) && (s3 == 0) )
M1 = 1'b1;
else if( (div >= 'd4545) && (div <= 'd2380) && (s2 == 0) && (s3 == 1) )
M2 = 1'b1;
else if( (div >= 'd3571) && (div <= 'd2083) && (s2 == 1) && (s3 == 1) )
M3 = 1'b1;
end
endmodule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you simulated this code?
There's quite a few issues in there that, I'm very sure, you'd spot if you did some simulation.
Cheers,
Alex
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page