if anyone interested, you should try deepseek to write some XC code. you will be surprised how much better it is than other leading LLM models.
Here is my question to deepseek and it's response.
how to use xmos to generate clocking signal for reading ccd output ?
==below are excerpt of response==
note that deepseek understand concept of port and timer on XMOS chips.
void generate_vertical_clocks() {
timer t;
uint32_t start_time;
while (1) {
t :> start_time; // Read the current time
// Generate V1 and V2 signals
p_v1 <: 1;
p_v2 <: 0;
t when timerafter(start_time + V1_V2_DELAY) :> void; // Wait for the specified delay
p_v1 <: 0;
p_v2 <: 1;
t when timerafter(start_time + 2 * V1_V2_DELAY) :> void; // Wait for the next pulse
}
}
deepseek is actually quite good at writing XC code
-
- Member
- Posts: 14
- Joined: Wed Sep 25, 2024 5:46 am
-
Verified
- XCore Legend
- Posts: 1154
- Joined: Thu May 27, 2010 10:08 am
That's not too bad. It's got the IO operators and GP timier timing code right. How about if you asked it to use port timers and timed outputs? Getting those right is harder (it wraps if you miss the compare match and you have to be aware of 16b timer instead of 32b) but can provide higher throughput as you can schedule future outputs and unblock the thread whilst it sets up the next one.
Engineer at XMOS