Difference: AnAdditionalLectureOnCProgramming (2 vs. 3)

Revision 32017-11-03 - uli

Line: 1 to 1
 
META TOPICPARENT name="LectureSlides"

Start Presentation

Slide 1: An additional Lecture on C Programming

Line: 135 to 135
 

Solution: arg count

Changed:
<
<
cmdLineCount.png
>
>
cmdLineCountv2.png
 

Argument Check

Line: 167 to 167
 

Solution: argument check

Changed:
<
<
checkArgs.png
>
>
genWavev2.png
 

Creating the wave form

Line: 255 to 255
 

Bit handling functions

Changed:
<
<
We need to learn a few bit handling functions before
>
>
We need to learn a few bit handling operators before
  being able to prepare the data for the DAC:
Changed:
<
<
| : bitwise or
>
>
| : bitwise or
 
Changed:
<
<
& : bitwise and
>
>
& : bitwise and
  data += 5 <=> data = data + 5
Line: 273 to 273
  data << 4 all bits in data are shifted left by 4
Changed:
<
<

>
>
example:

data = 16  00010000
data >> 4  00000001
 

DAC preparation

Write a function which prepares a byte for the DAC

Line: 316 to 319
 

Send one short value to the DAC

Changed:
<
<
Now that we know how to strobe it is easy to write
>
>
Now that we know how to strobe, it is easy to write
  a 12 bit value to the DAC

We must do it in 3 steps:

Changed:
<
<
  • and out all the bits in the data word
    except the last 4 (first data nibble)
>
>
  • "and" out all the bits in the data word
    except the last 4 (first data nibble)
 
  • “or” in the rw and register bits (must be reg 0! )
    and send the dataByte to strobe

Changed:
<
<
  • Shift the data word by for bits and do the same thing
    (now the register bits must be 1 of course)
>
>
  • Shift the data word by for bits and do the same thing
    (now the register bits must be 1 of course)

 
  • Shift again by 4 bits and repeat

Solution: send one data word

Line: 391 to 394
 
META FILEATTACHMENT attachment="sineFunc.png" attr="" comment="" date="1507537960" name="sineFunc.png" path="sineFunc.png" size="68602" user="uli" version="1"
META FILEATTACHMENT attachment="strobe.png" attr="" comment="" date="1507537960" name="strobe.png" path="strobe.png" size="46229" user="uli" version="1"
META FILEATTACHMENT attachment="waveGen.odp" attr="" comment="" date="1508157571" name="waveGen.odp" path="waveGen.odp" size="786000" user="uli" version="1"
Added:
>
>
META FILEATTACHMENT attachment="cmdLineCountv2.png" attr="" comment="" date="1509720249" name="cmdLineCountv2.png" path="cmdLineCountv2.png" size="21507" user="uli" version="1"
META FILEATTACHMENT attachment="argCheckv2.png" attr="" comment="" date="1509720390" name="argCheckv2.png" path="argCheckv2.png" size="49568" user="uli" version="1"
META FILEATTACHMENT attachment="genWavev2.png" attr="" comment="" date="1509720806" name="genWavev2.png" path="genWavev2.png" size="59492" user="uli" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback