Skip to content

Instantly share code, notes, and snippets.

@adiaz101
adiaz101 / LEDTest.ino
Created July 26, 2015 01:42
SlaveCode
#include <Wire.h>
#define SLAVE_ADDRESS 0x04
int number = 0;
int state = 0;
void setup()
{
void setup() {
// initialize serial communication:
// pinMode(P)
Serial.begin(9600);
pinMode(PD_1, OUTPUT);
pinMode(PD_7, INPUT);
}
@adiaz101
adiaz101 / Factorial.v
Last active August 29, 2015 14:21
HW4
// // Define a function to calculate the factorial of a 4-bit number. The output
// // is a 32-bit value. Invoke the function by using stimulus and check the results
module factorial;
reg [3:0] in;
function calc_factorial;
input []
@adiaz101
adiaz101 / todo.TODO
Created May 11, 2015 18:24
Embedded Study guide
Things to do Today:
☐ Study guide for Embedded systems
☐ Understand nyquist criterion and how it applies
☐ Analog to digital conversion problem
Using the successive approximation algorithm
☐ find info on the book about fixed point algorithm
☐ Find info on digital to analog converter problems that includes hardware
☐ Assembly code
write instruction code , use your own code
☐ Write a small C function
@adiaz101
adiaz101 / test
Created April 23, 2015 04:16
test
#include "inc/tm4c123gh6pm.h"
void PORTF_INIT(void)
{
SYSCTL_RCGCGPIO_R |= 0x01;// activate the clock
while((SYSCTL_RCGCGPIO_R & 0x01) == 0)
{
}
GPIO_PORTA_LOCK_R = 0x4C4F434B; //unluck GPIO PORT A
GPIO_PORTA_CR_R = 0xFF; //allows changes to PA7-0;
@adiaz101
adiaz101 / gist:b0923fa38ff31acdb4d9
Created April 23, 2015 04:14
problem 6.1 - 6.3
module mult (a, b, start, clk, r, done);
input [7:0] a, b;
input start, clk;
output [15:0] r;
output done
endmodule
`timescale 1ns/100ps
module TestBench6.1;
reg [7:0] a, b;
2.1a) 0(M), 2(M), 4(M), 0(M), 2(M), 4(M), 0(M), 2(M), 4(M) - 0 Hits
2.1b) 0(M), 2(M), 4(M), 2(H), 0(M), 2(H), 4(M), 0(M), 2(M) - 2 Hits
2.2a) 0(M), 2(M), 4(M), 0(H), 2(M), 4(H), 0(M), 2(H), 4(M) - 3 Hits
2.2b) 0(M), 2(M), 4(M), 2(M), 0(H), 2(H), 4(M), 0(H), 2(M) - 3 Hits
3.a) 2^x = 16 where X is the bits used for the offset which is 4
3.b) 128 * 1024 = 131072 / 16 = 8192
2^X = 8192 where X is the index which is 13 bits
@adiaz101
adiaz101 / test.java
Last active August 29, 2015 14:15
test1
public class test
{
private int var = 3;
String one;
one = "this is just a test";
public static void main(String[] args)