4. In this problem you will use CodeWarrior to develop the code to implement a three-light traffic signal. The program should do the following:
a. Turn on a green LED attached to Port B bit 2 for 60 seconds,
b. Turn off the green LED and turn on a yellow LED attached to Port B bit 1 for 30 seconds,
c. Turn off the yellow LED and turn on a red LED attached to Port B bit 0 for 60 seconds,
d. Turn off the red LED and repeat steps a through d continuously.
Start up CodeWarrior and configure it to run in the normal way for an absolute assembler in Full Chip Simulation mode. The code for a 1 ms delay loop is below: ldy #6000 loop: dey bne loop
Some useful instructions are on the next pages. If you think you need some instructions that don’t appear on the following pages just ask.
Note that you can test your code using CodeWarrior by entering small numbers for the loops (e.g., 6 in place of 6000) and stepping through your code in simulation mode to see if the appropriate bits are set and cleared at Port B. Be sure to replace the smaller numbers with the correct ones before submitting your solution.
Watch out for error messages, particularly relating to putting big numbers in small registers (e.g., >255 in an 8-bit register, or >65,535 in a 16-bit register).
When you’ve finished, save your CodeWarrior .asm file and send it to me along with your completed exam. Also cut and paste your code below, just in case.
int red =10;
int yellow=9;
int green=8;
void setup(){
pinMode(red, OUTPUT);
pinMode(yellow, OUTPUT);
pinMode(green, OUTPUT);
}
void loop(){
changeLights();
delay(60000);
}
void changeLights(){
// green on, yellow on for 60 seconds
digitalWrite(green, HIGH);
delay(60000);
// turn off green, then turn yellow on for 30 seconds
digitalWrite(green, LOW);
digitalWrite(yellow, HIGH);
delay(30000);
// turn off green and yellow, then turn on red
digitalWrite(yellow, LOW);
digitalWrite(green, LOW);
digitalWrite(red, HIGH);
delay(60000);
}
4. In this problem you will use CodeWarrior to develop the code to implement a three-light...
Use HCS12 assembly language only - not C code Using CodeWarrior to create a new project that uses assembly language. Write an assembly program that turns on the red LED at the beginning. It switches to off 2 seconds later and switches back to on after three more seconds. (That is, it stays on for 2 seconds and off for 3 seconds.) This switching process lasts forever. Use a loop (or nested loops) for each of the 2/3-second delay where...
Assembly Language Using CodeWarrior to create a new project that uses assembly language. Write an assembly program that turns on the red LED at the beginning. It switches to off 2 seconds later and switches back to on after three more seconds. (That is, it stays on for 2 seconds and off for 3 seconds.) This switching process lasts forever. Use a loop (or nested loops) for each of the 2/3-second delay where the loop body of the inner-most loop...
Having trouble with an automatic traffic light program. Red LED and Yellow LED won't show. We are using a Dragon12 Plus 2 board, Code is below #include C:\Users\schwarzenbar\Desktop\hcs12.inc RED: EQU $10 ;PP4 GREEN: EQU $40 ;PP6 org $2000 movb #$FF, DDRP bset PTP, #RED bset DDRT,%00110000 ;PT4=Output for for IR Transmiter (IRTX) bclr DDRT,%00001000 ;PT3=Input pin for IR receiver (IRRX) bclr PTT,%00001000 ;PT4=0 to turn on IR...
using C code
codewarrior
how can I create a loop that it will display 1 through 9 with
a delay between each number
/Exaple 1a Turn on every other seguent on 7-seg display #include chideth) #include /* derivative information */ #pragna LINK-INFO DERIVATIVE "nc9s12dg256b" /CONNon defines and nacros/ 0 #include "nain-asn h" /* interface to the assenbly nodule */ /*put your own code here / PLL init() 52 // set systen clock frequency to 24 MHz 28. DDREOxff DDRP 0xff...
Can someone please help me with this problem? We are using
CodeWarrior to write this program in assembly language.
The array sample contains eight 8-bit signed binary numbers (integers) as shown below. Write a program which stores the negative numbers in the array nelements, computes the sum of the positive numbens to be stored in the variable psum and stores the number of the positive numbers in the variable pnumber. Note that a zero is ther positive nor negative. Your...
Implement the following statements using MS430 assembly instructions. You may use more than one, but you should minimize the number of instructions required. You can use both native and emulated instructions. Use hex notation for all numbers 1. (a) Move the word located in register R14 to R15 (b) Increment the word in R6 by 2. (c) Perform a bitwise ANDing of the word located at address 0x0240 with the datum in R15, placing the results in R15. (d) Rotate...
Application Problem: Answer the following questions at the bottom of the worksheet: You are configuring a microcontroller (uC) to sample a signal connected to an input pin. Part of the initial setup requires that you clear (turn off) bits #17 and #2 in a 32-bit register, while leaving all other bits unchanged. To work with specific bits, we typically use a second number, called a mask, which has the bit positions we need to alter set to 1, and all...
Please help with my car traffic simulator!
Code that I already have below, I do not know how to start it
off!
public class IntersectionSimulation
{
private final static int EAST_WEST_GREEN_TIME = 30 ;
private final static int[] NORTH_SOUTH_GREEN_TIMES = { 20, 24, 30, 42 } ;
private final static int[] CAR_INTERSECTION_RATES = { 3, 5, 10 } ;
private final static int[] CAR_QUEUEING_RATES = { 5, 10, 30 } ;
private final static int[] EXPERIMENT_DURATIONS = { 3*60, 5*60,...
There is an example below
Now that everything is working you can try the following exercises. To complete them you will need to refer to the documentation in Appendix A The MiteASM Assembler and Appendix B The MiteFPGA Processor. Write an assembly language program for an over counter for a cricket umpire. This should 1. display a count on the 7-segment display. The count should increase by 1 when button 0 is pressed. It should reset to 0 when button...
The following guidelines outline the basic template for a robot vacuum cleaner game. The game must be implemented in c programming language. It mimics a robotic vacuum cleaner. The code must only use the following libraries: #include <math.h> #include <stdlib.h> #include <string.h> #include <limits.h> and any .graphics and .timers libraries. The guidelines are outlined as follows: Terminal Set-up: you may assume that the terminal will be quite large, for example, on the order of 150×50, or more. Status Display: The...