• entries
58
218
• views
114779

# TV & ASM

510 views

There were a lot of questions about the interactions between Spin and ASM from the last entry. In case I wasn't clear, Spin does NOT compile down to Propeller ASM. It runs natively on the chip, through the use of a built in interpreter. Programs for the Propeller must use at least a few lines of Spin to get the program going, as the boot up sequence built into the Propeller can only start with Spin code.

In my last entry, I posted an example in Spin that blinks an LED connected to the Propeller on and off 5 times. Some of you may have wanted to see the same example in ASM, so here you are (this time I commented everything so you can see what is going on. Also note that this example will loop forever, instead of only 5 times.):

' defines the start of a constants blockCON    ' sets the special clock mode constant to use crystal input one and a phase    ' locked loop (PLL) multiplier of 16.    _clkmode = xtal1 + pll16x    ' sets the input frequency of the clock to 5MHz    _xinfreq = 5_000_000         ' defines a public function called Start. The first function in a ' file is the entry point for the program.PUB Start                   ' starts a new cog (ie. a core) which will run instructions starting    ' at the given address    cognew(@entry, 0)         ' defines the start of a data sectionDAT    ' sets the origin of all ASM code to the first address    org 0    mov dira, 16   ' set pin 16 to output mode    mov time, cnt  ' initialize the time variable with the current clock    add time, #9   ' add nine to the initial time variable' create a label called :loop:loop    xor     outa, 16    ' toggle the state of pin 16 (high or low)        ' wait until the clock equals time, and then add delay to time    waitcnt time, delay     xor     outa, 16    ' toggle the state of pin 16 (high or low)    ' wait until the clock equals time, and then add delay to time    waitcnt time, delay     ' jump back to the loop label    jmp #:loop' define a variable with a size of long with an initial value of 40,000,000delay long 40_000_000' reserve space for a variable with a size of one longtime res 1

On a different note, I purchased a handful of RCA connectors from Jameco so that I can connect the Propeller to the TV. Unfortunately, the leads don't fit into the breadboard, so I had to do a little hacking by adding some wire to the end of each lead.

I connected this to the Propeller through a four bit DAC (digital to analog converter) which allows me to blend the output of four separate pins into one composite NTSC signal. (I found a sample circuit for this on the Parallax website).

So now I have a TV output for my board. The next step is to get video going and to have something interesting to show for my efforts.

There are no comments to display.

## Create an account

Register a new account