summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthing1 <thing1@Thing1LAP.my.domain>2024-09-05 18:20:24 +0100
committerthing1 <thing1@Thing1LAP.my.domain>2024-09-05 18:20:24 +0100
commit9b83439d9d0204a5092772ae46ef43cea42dbc7c (patch)
tree1553eb58a8dbaa2f12bfa286880579b6b84edbda
parentc818366f33527bbd0d23d7ff983bb1eaf82fa34b (diff)
added some nice stuff
-rw-r--r--comp/lucas-standen-NEA/code2/Makefile2
-rw-r--r--comp/lucas-standen-NEA/code2/comp.c100
-rw-r--r--comp/lucas-standen-NEA/code2/comp.h3
-rw-r--r--comp/lucas-standen-NEA/code2/gdb.corebin0 -> 10729440 bytes
-rwxr-xr-xcomp/lucas-standen-NEA/code2/samplebin15464 -> 6432 bytes
-rw-r--r--comp/lucas-standen-NEA/code2/sample.zpy9
-rw-r--r--comp/lucas-standen-NEA/code2/tokenizer.c5
-rwxr-xr-xcomp/lucas-standen-NEA/code2/zpybin0 -> 24216 bytes
-rw-r--r--comp/lucas-standen-NEA/code2/zpy.c3
-rw-r--r--comp/lucas-standen-NEA/code2/zpy.corebin0 -> 299160 bytes
-rwxr-xr-xcomp/lucas-standen-NEA/code2/zpy.sh2
-rw-r--r--other/day1/Makefile2
-rw-r--r--other/day1/workexperience.ps288
13 files changed, 199 insertions, 215 deletions
diff --git a/comp/lucas-standen-NEA/code2/Makefile b/comp/lucas-standen-NEA/code2/Makefile
index 50e44c2..0ebc2c5 100644
--- a/comp/lucas-standen-NEA/code2/Makefile
+++ b/comp/lucas-standen-NEA/code2/Makefile
@@ -1,4 +1,4 @@
-CC = gcc
+CC = cc
CFLAGS = -O0 -ggdb
all: _zpy _parser _tokenizer _comp _util _debug
diff --git a/comp/lucas-standen-NEA/code2/comp.c b/comp/lucas-standen-NEA/code2/comp.c
index c11fdd8..4bc67e9 100644
--- a/comp/lucas-standen-NEA/code2/comp.c
+++ b/comp/lucas-standen-NEA/code2/comp.c
@@ -12,11 +12,11 @@ char *names[] = {
"if", // takes a condition // 4
"endif", // takes no args // 5
"elif", // same as if, but only executes if the prev statment didnt // 6
- "else", // its else! //
+ "else", // its else! // 7
"for", // takes a iterator and type, a condition, and an increment // 8
"endfor", // takes no args // 9
"write", // takes an int and puts it on the screen // 10
- "symbol",
+ "symbol", // takes a name and return type and args
"+",
"-",
"*",
@@ -33,7 +33,7 @@ char *names[] = {
"return",
};
-void vartypeToC(char *str){
+void vartypeToC(char *str, FILE *f){
char *name = malloc(strlen(str));
char *type = malloc(strlen(str));
@@ -57,12 +57,12 @@ void vartypeToC(char *str){
}
type[j] = '\0';
- printf("%s %s", type, name);
+ fprintf(f, "%s %s", type, name);
free(type);
free(name);
}
-char *getVarName(char *exp){
+char *getVarName(char *exp, FILE *f){
char *out = malloc(strlen(exp));
memcpy(out, exp, strlen(exp));
char *pos = strchr(out, ':');
@@ -70,68 +70,90 @@ char *getVarName(char *exp){
return out;
}
-void reversepolishToC(astNode *exp){
- printf("%s ", exp->args[0]);
- if (exp->func[0] == '=') printf("==");
- else printf("%s", exp->func);
- printf(" %s", exp->args[1]);
+void reversepolishToC(astNode *exp, FILE *f){
+ fprintf(f, "%s ", exp->args[0]);
+ if (exp->func[0] == '=') fprintf(f, "==");
+ else fprintf(f, "%s", exp->func);
+ fprintf(f, " %s", exp->args[1]);
}
-void compile(astNode *node){
+void compile(astNode *node, FILE *f){
if (strcmp(names[0], node->func) == 0){
- printf("%s %s(", node->args[1], node->args[0]);
+ fprintf(f, "%s %s(", node->args[1], node->args[0]);
int i = 2;
while (node->args[i] != NULL){
- vartypeToC(node->args[i]);
+ vartypeToC(node->args[i], f);
i++;
}
- printf("){\n");
+ fprintf(f, "){\n");
}
else if (strcmp(names[1], node->func) == 0){
- printf("\n}\n");
+ fprintf(f, "\n}\n");
}
else if (strcmp(names[2], node->func) == 0){
- printf("const ");
- vartypeToC(node->args[0]);
- printf(" = %s;\n", node->args[1]);
+ fprintf(f, "const ");
+ vartypeToC(node->args[0], f);
+ fprintf(f, " = %s;\n", node->args[1]);
}
else if (strcmp(names[3], node->func) == 0){
- vartypeToC(node->args[0]);
- printf(" = %s;\n", node->args[1]);
+ vartypeToC(node->args[0], f);
+ fprintf(f, " = %s;\n", node->args[1]);
}
else if (strcmp(names[4], node->func) == 0){
- printf("if (");
- reversepolishToC(node->children[0]);
- printf("){\n");
+ fprintf(f, "if (");
+ reversepolishToC(node->children[0], f);
+ fprintf(f, "){\n");
}
else if (strcmp(names[5], node->func) == 0){
- printf("\n}\n");
+ fprintf(f, "\n}\n");
}
else if (strcmp(names[6], node->func) == 0){
- printf("\n}\n");
- printf("else if (");
- reversepolishToC(node->children[0]);
- printf("){\n");
+ fprintf(f, "\n}\n");
+ fprintf(f, "else if (");
+ reversepolishToC(node->children[0], f);
+ fprintf(f, "){\n");
}
else if (strcmp(names[7], node->func) == 0){
- printf("\n}\n");
- printf("else{");
+ fprintf(f, "\n}\n");
+ fprintf(f, "else{");
}
else if (strcmp(names[8], node->func) == 0){
- printf("for (");
- vartypeToC(node->args[0]);
- printf(" = 0;");
- reversepolishToC(node->children[1]);
- printf("; %s+=%s){", getVarName(node->args[0]), node->args[2]);
+ fprintf(f, "for (");
+ vartypeToC(node->args[0], f);
+ fprintf(f, " = 0;");
+ reversepolishToC(node->children[1], f);
+ fprintf(f, "; %s+=%s){", getVarName(node->args[0], f), node->args[2]);
}
else if (strcmp(names[9], node->func) == 0){
- printf("\n}\n");
+ fprintf(f, "\n}\n");
}
else if (strcmp(names[10], node->func) == 0){
- printf("printf(\"");
- printf("%%d\\n");
- printf("\", %s);", node->args[0]);
+ fprintf(f, "printf(\"");
+ fprintf(f, "%%d\\n");
+ fprintf(f, "\", %s);", node->args[0]);
}
+ else if (strcmp(names[11], node->func) == 0){
+ fprintf(f, "%s %s(", node->args[1], node->args[0]);
+ int i = 2;
+ while (node->args[i] != NULL){
+ vartypeToC(node->args[i], f);
+ i++;
+ }
+ fprintf(f, ");\n");
+ }
+ else if (strcmp(names[12], node->func) == 0){
+ reversepolishToC(node->children[0], f);
+ }
+ else {
+ fprintf(f, "%s(", node->func);
+ int i = 0;
+ while (node->args[i] != NULL){
+ fprintf(f, "%s", node->args[i]);
+ i++;
+ }
+ fprintf(f, ");\n");
+ }
}
+
diff --git a/comp/lucas-standen-NEA/code2/comp.h b/comp/lucas-standen-NEA/code2/comp.h
index 840cd16..b04056f 100644
--- a/comp/lucas-standen-NEA/code2/comp.h
+++ b/comp/lucas-standen-NEA/code2/comp.h
@@ -1,2 +1,3 @@
#include "tokenizer.h"
-void compile(astNode *node);
+#include <stdio.h>
+void compile(astNode *node, FILE *f);
diff --git a/comp/lucas-standen-NEA/code2/gdb.core b/comp/lucas-standen-NEA/code2/gdb.core
new file mode 100644
index 0000000..046f004
--- /dev/null
+++ b/comp/lucas-standen-NEA/code2/gdb.core
Binary files differ
diff --git a/comp/lucas-standen-NEA/code2/sample b/comp/lucas-standen-NEA/code2/sample
index 08dda04..d026169 100755
--- a/comp/lucas-standen-NEA/code2/sample
+++ b/comp/lucas-standen-NEA/code2/sample
Binary files differ
diff --git a/comp/lucas-standen-NEA/code2/sample.zpy b/comp/lucas-standen-NEA/code2/sample.zpy
index c8eaba1..b4bfacb 100644
--- a/comp/lucas-standen-NEA/code2/sample.zpy
+++ b/comp/lucas-standen-NEA/code2/sample.zpy
@@ -1,9 +1,6 @@
+(let a:int (+ 65 2))
+(symbol putchar int c:int)
(defun main int)
-(let i:int 10)
-(let a:int 10)
-
-(if (= i a))
-(write a)
-(endif)
+(putchar a)
(endfun)
diff --git a/comp/lucas-standen-NEA/code2/tokenizer.c b/comp/lucas-standen-NEA/code2/tokenizer.c
index 10c70a7..6275a7a 100644
--- a/comp/lucas-standen-NEA/code2/tokenizer.c
+++ b/comp/lucas-standen-NEA/code2/tokenizer.c
@@ -38,6 +38,11 @@ int readuntil(char *src, char c, char *dst){ // returns how many chars read, wil
astNode *tokenize(char *line){ // asume the first set of brackets have been stripped
astNode *head = malloc(sizeof(astNode));
+ head->func = NULL;
+ for (int i = 0; i < 8; i++){
+ head->args[i] = NULL;
+ head->children[i] = NULL;
+ }
int depth = 0;
int argCount = 0;
diff --git a/comp/lucas-standen-NEA/code2/zpy b/comp/lucas-standen-NEA/code2/zpy
new file mode 100755
index 0000000..2534f0c
--- /dev/null
+++ b/comp/lucas-standen-NEA/code2/zpy
Binary files differ
diff --git a/comp/lucas-standen-NEA/code2/zpy.c b/comp/lucas-standen-NEA/code2/zpy.c
index 69eb6c3..6e22b7b 100644
--- a/comp/lucas-standen-NEA/code2/zpy.c
+++ b/comp/lucas-standen-NEA/code2/zpy.c
@@ -20,11 +20,12 @@ int main(int argc, char **argv){
if (stringTokens == NULL)
die("couldn't parse file, is it formated properly?");
+
for (int i = 0; i < stringTokens->count; i++){
stringTokens->strs[i]++;
stringTokens->strs[i][strlen(stringTokens->strs[i]) - 1] = '\0';
astNode *line = tokenize(stringTokens->strs[i]);
- compile(line);
+ compile(line, stdout);
}
diff --git a/comp/lucas-standen-NEA/code2/zpy.core b/comp/lucas-standen-NEA/code2/zpy.core
new file mode 100644
index 0000000..a9fb131
--- /dev/null
+++ b/comp/lucas-standen-NEA/code2/zpy.core
Binary files differ
diff --git a/comp/lucas-standen-NEA/code2/zpy.sh b/comp/lucas-standen-NEA/code2/zpy.sh
index 72259c2..7dc663e 100755
--- a/comp/lucas-standen-NEA/code2/zpy.sh
+++ b/comp/lucas-standen-NEA/code2/zpy.sh
@@ -1,2 +1,2 @@
#!/bin/sh
-./zpy $1 | cc -x c - -Wno-implicit -Wno-builtin-declaration-mismatch -o $2
+./zpy $1 | cc -x c - -Wno-implicit -Wno-missing-declarations -o $2
diff --git a/other/day1/Makefile b/other/day1/Makefile
index 0c1ec8a..b366c6c 100644
--- a/other/day1/Makefile
+++ b/other/day1/Makefile
@@ -1,4 +1,4 @@
all:
- exec ./make.sh
+ exec sh ./make.sh
clean:
rm -rf ./*.pdf
diff --git a/other/day1/workexperience.ps b/other/day1/workexperience.ps
index 1cabf19..4a234ab 100644
--- a/other/day1/workexperience.ps
+++ b/other/day1/workexperience.ps
@@ -1,6 +1,6 @@
%!PS-Adobe-3.0
-%%Creator: groff version 1.23.0
-%%CreationDate: Tue Jun 4 09:01:40 2024
+%%Creator: groff version 1.22.4
+%%CreationDate: Thu Sep 5 13:14:44 2024
%%DocumentNeededResources: font Times-Bold
%%+ font Times-Italic
%%+ font Times-Roman
@@ -8,9 +8,9 @@
%%+ file wirebonds.ps
%%+ file scope.ps
%%+ file graph.ps
-%%+ procset grops 1.23 0
+%%+ procset grops 1.22 4
%%LanguageLevel: 2
-%%Pages: 7
+%%Pages: 6
%%PageOrder: Ascend
%%DocumentMedia: Default 612 792 0 () ()
%%Orientation: Portrait
@@ -19,7 +19,7 @@
%%PageMedia: Default
%%EndDefaults
%%BeginProlog
-%%BeginResource: procset grops 1.23 0
+%%BeginResource: procset grops 1.22 4
%!PS-Adobe-3.0 Resource-ProcSet
/setpacking where{
pop
@@ -27,7 +27,6 @@ currentpacking
true setpacking
}if
/grops 120 dict dup begin
-% The ASCII code of the space character.
/SC 32 def
/A/show load def
/B{0 SC 3 -1 roll widthshow}bind def
@@ -49,18 +48,16 @@ true setpacking
/R{moveto 0 SC 3 -1 roll widthshow}bind def
/S{moveto 0 exch ashow}bind def
/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-% name size font SF -
/SF{
findfont exch
[exch dup 0 exch 0 exch neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
}bind def
-% name a c d font MF -
/MF{
findfont
[5 2 roll
-0 3 1 roll % b
+0 3 1 roll
neg 0 0]makefont
dup setfont
[exch/setfont cvx]cvx bind def
@@ -69,19 +66,13 @@ dup setfont
/RES 0 def
/PL 0 def
/LS 0 def
-% Enable manual feed.
-% MANUAL -
/MANUAL{
statusdict begin/manualfeed true store end
}bind def
-% Guess the page length.
-% This assumes that the imageable area is vertically centered on the page.
-% PLG - length
/PLG{
gsave newpath clippath pathbbox grestore
exch pop add exch pop
}bind def
-% BP -
/BP{
/level0 save def
1 setlinecap
@@ -99,61 +90,47 @@ LS{
level0 restore
showpage
}def
-% centerx centery radius startangle endangle DA -
/DA{
newpath arcn stroke
}bind def
-% x y SN - x' y'
-% round a position to nearest (pixel + (.25,.25))
/SN{
transform
.25 sub exch .25 sub exch
round .25 add exch round .25 add exch
itransform
}bind def
-% endx endy startx starty DL -
-% we round the endpoints of the line, so that parallel horizontal
-% and vertical lines will appear even
/DL{
SN
moveto
SN
lineto stroke
}bind def
-% centerx centery radius DC -
/DC{
newpath 0 360 arc closepath
}bind def
/TM matrix def
-% width height centerx centery DE -
/DE{
TM currentmatrix pop
translate scale newpath 0 0 .5 0 360 arc closepath
TM setmatrix
}bind def
-% these are for splines
/RC/rcurveto load def
/RL/rlineto load def
/ST/stroke load def
/MT/moveto load def
/CL/closepath load def
-% fill the last path
-% r g b Fr -
/Fr{
setrgbcolor fill
}bind def
-% c m y k Fk -
/setcmykcolor where{
pop
/Fk{
setcmykcolor fill
}bind def
}if
-% g Fg -
/Fg{
setgray fill
}bind def
-% fill with the "current color"
/FL/fill load def
/LW/setlinewidth load def
/Cr/setrgbcolor load def
@@ -162,7 +139,6 @@ pop
/Ck/setcmykcolor load def
}if
/Cg/setgray load def
-% new_font_name encoding_vector old_font_name RE -
/RE{
findfont
dup maxlength 1 index/FontName known not{1 add}if dict begin
@@ -177,7 +153,6 @@ dup/FontName exch def
currentdict end definefont pop
}bind def
/DEFS 0 def
-% hpos vpos EBEGIN -
/EBEGIN{
moveto
DEFS begin
@@ -185,13 +160,11 @@ DEFS begin
/EEND/end load def
/CNT 0 def
/level1 0 def
-% llx lly newwid wid newht ht newllx newlly PBEGIN -
/PBEGIN{
/level1 save def
translate
div 3 1 roll div exch scale
neg exch neg exch translate
-% set the graphics state to default values
0 setgray
0 setlinecap
1 setlinewidth
@@ -210,10 +183,6 @@ newpath
/CNT countdictstack def
userdict begin
/showpage{}def
-%
-% Any included setpagedevice should be ignored.
-% See: http://www.w-beer.de/doc/ps/.
-%
/setpagedevice{}def
mark
}bind def
@@ -271,58 +240,56 @@ def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 12/Times-Bold@0 SF(Notes on w)255.228 123 Q(ork done)-.12 E/F1 10
-/Times-Italic@0 SF(Lucas Standen + Nig)242.675 159 Q(el Standen)-.1 E/F2
-10/Times-Roman@0 SF(29/5/24)290.72 177 Q/F3 10/Times-Bold@0 SF 2.5
+/F0 12/Times-Bold@0 SF(Notes on w)237.228 123 Q(ork done)-.12 E/F1 10
+/Times-Italic@0 SF(Lucas Standen + Nig)224.675 159 Q(el Standen)-.1 E/F2
+10/Times-Roman@0 SF(29/5/24)272.72 177 Q/F3 10/Times-Bold@0 SF 2.5
(1. Ho)72 213 R 2.5(wt)-.1 G(he curr)-2.5 E
(ent of an LED can effect the wa)-.18 E -.1(ve)-.25 G
(length of the output).1 E 2.5(1.1. The)72 237 R(experiment)2.5 E F2
-.447(In the e)72 252.6 R .447(xperiment we measured ho)-.15 F 2.947(wt)
--.25 G .447(he w)-2.947 F -2.25 -.2(av e)-.1 H .447
-(length of an LED is ef).2 F .447
-(fected by the current passed through it. The re-)-.25 F
-(sults lead one to belie)72 264.6 Q .3 -.15(ve t)-.25 H
+(In the e)72 252.6 Q(xperiment we measured ho)-.15 E 2.5(wt)-.25 G(he w)
+-2.5 E -2.25 -.2(av e)-.1 H(length of an LED is ef).2 E
+(fected by the current passed through it.)-.25 E
+(The results lead one to belie)72 264.6 Q .3 -.15(ve t)-.25 H
(hat as current increases the w).15 E -2.25 -.2(av e)-.1 H
-(length does too.).2 E 2.414 -.8(We m)72 288.6 T .815(ade sure to measu\
-re using a pulse, rather than a continuous current, this is to ensure t\
-hat the thermal ener).8 F(gy)-.18 E .113(that the LED gi)72 300.6 R -.15
-(ve)-.25 G 2.613(so).15 G -.25(ff)-2.613 G 2.613(,d).25 G .113
-(oes not ef)-2.613 F .113(fect its results; ho)-.25 F(we)-.25 E -.15(ve)
--.25 G 2.613(rw).15 G 2.613(eb)-2.613 G(elie)-2.613 E .413 -.15(ve o)
--.25 H .113(ur pulse w).15 F .112(as still to long and that it did ef)
--.1 F(fect)-.25 E(the results.)72 312.6 Q .772(The pulse is generated b\
-y an Arduino with a simple script running, allo)72 336.6 R .772
-(wing me to press a b)-.25 F .772(utton that triggers the)-.2 F(po)72
-348.6 Q .871(wer supply and the spectrometer \(tool used to measure w)
--.25 F -2.25 -.2(av e)-.1 H .871(lengths\). Before starting the e).2 F
-.871(xperiment, we took a)-.15 F(reading of ambient temperature, as we \
-were looking at current \(which ef)72 360.6 Q(fects temperature\) ag)
--.25 E(ainst w)-.05 E -2.25 -.2(av e)-.1 H(length.).2 E 1.6 -.8(We f)72
-384.6 T(ound the temperature to be).8 E F3(20 deg C)2.5 E F2(.)A F3 2.5
-(1.1.1. T)72 420.6 R(riggering cir)-.74 E(cuit)-.18 E F2 .75
-(The triggering circuit w)72 436.2 R .75(as k)-.1 F .75
+(length does too.).2 E 1.6 -.8(We m)72 288.6 T(ade sure to measure usin\
+g a pulse, rather than a continuous current, this is to ensure that the\
+ thermal).8 E(ener)72 300.6 Q(gy that the LED gi)-.18 E -.15(ve)-.25 G
+2.5(so).15 G -.25(ff)-2.5 G 2.5(,d).25 G(oes not ef)-2.5 E
+(fect its results; ho)-.25 E(we)-.25 E -.15(ve)-.25 G 2.5(rw).15 G 2.5
+(eb)-2.5 G(elie)-2.5 E .3 -.15(ve o)-.25 H(ur pulse w).15 E
+(as still to long and)-.1 E(that it did ef)72 312.6 Q(fect the results.)
+-.25 E(The pulse is generated by an Arduino with a simple script runnin\
+g, allo)72 336.6 Q(wing me to press a b)-.25 E(utton that)-.2 E
+(triggers the po)72 348.6 Q
+(wer supply and the spectrometer \(tool used to measure w)-.25 E -2.25
+-.2(av e)-.1 H(lengths\). Before starting the).2 E -.15(ex)72 360.6 S(p\
+eriment, we took a reading of ambient temperature, as we were looking a\
+t current \(which ef).15 E(fects)-.25 E(temperature\) ag)72 372.6 Q
+(ainst w)-.05 E -2.25 -.2(av e)-.1 H(length.).2 E 1.6 -.8(We f)72 396.6
+T(ound the temperature to be).8 E F3(20 deg C)2.5 E F2(.)A F3 2.5
+(1.1.1. T)72 432.6 R(riggering cir)-.74 E(cuit)-.18 E F2
+(The triggering circuit w)72 448.2 Q(as k)-.1 E
(ept simple, with most things being done in code, one thing of note ho)
--.1 F(we)-.25 E -.15(ve)-.25 G 3.25(ri).15 G 3.25(st)-3.25 G .75
-(hat the)-3.25 F(push b)72 448.2 Q
-(utton used as a trigger is in a push to mak)-.2 E 2.5(ec)-.1 G
-(on\214guration.)-2.5 E 1.6 -.8(To w)72 472.2 T(ire the circuit follo).8
-E 2.5(wt)-.25 G(hese steps:)-2.5 E(1\) Attach a b)72 496.2 Q
+-.1 E(we)-.25 E -.15(ve)-.25 G 2.5(ri).15 G(s)-2.5 E(that the push b)72
+460.2 Q(utton used as a trigger is in a push to mak)-.2 E 2.5(ec)-.1 G
+(on\214guration.)-2.5 E 1.6 -.8(To w)72 484.2 T(ire the circuit follo).8
+E 2.5(wt)-.25 G(hese steps:)-2.5 E(1\) Attach a b)72 508.2 Q
(utton between pin 2, and ground.)-.2 E
-(2\) Attach pin 7 to the spectroscope')72 520.2 Q 2.5(sl)-.55 G -2.15
+(2\) Attach pin 7 to the spectroscope')72 532.2 Q 2.5(sl)-.55 G -2.15
-.25(iv e)-2.5 H
(input, and attach its ground to a ground rail on the bread board.)2.75
-E(3\) Attach pin 8 to the PSU')72 544.2 Q 2.5(sl)-.55 G -2.15 -.25(iv e)
+E(3\) Attach pin 8 to the PSU')72 556.2 Q 2.5(sl)-.55 G -2.15 -.25(iv e)
-2.5 H(input and its ground to a shared ground.)2.75 E(4\) Using the Ar\
-duino ide, \215ash the code \(can be found on the USB you g)72 568.2 Q
+duino ide, \215ash the code \(can be found on the USB you g)72 580.2 Q
-2.25 -.2(av e)-.05 H(me\).)2.7 E
-(5\) Set up the program on the PSU to ha)72 592.2 Q .3 -.15(ve a p)-.2 H
+(5\) Set up the program on the PSU to ha)72 604.2 Q .3 -.15(ve a p)-.2 H
(ulse duration as long as you need, and then press the b).15 E(utton.)
--.2 E(The code for this can be seen here as well:)72 619.8 Q 0 Cg EP
+-.2 E(The code for this can be seen here as well:)72 631.8 Q 0 Cg EP
%%Page: 2 2
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-2-)300.17 48 Q(const int instrument1Pin = 7; /\
+/F0 10/Times-Roman@0 SF(-2-)282.17 48 Q(const int instrument1Pin = 7; /\
/ Pin for instrument 1 \(0V to 5V\) Spectroscope)77 84 Q
(const int instrument2Pin = 8; // Pin for instrument 2 \(5V to 0V\) PSU)
77 108 Q(const int triggerPin = 2; // the pin the b)77 132 Q
@@ -343,25 +310,24 @@ rument2Pin, HIGH\); // HIGH corresponds to 5V \(max v)97 276 Q(alue\))
(delay\(pulseDurationInMs - psuDelayInMs\);)117 420 Q
(digitalWrite\(instrument2Pin, HIGH\);)117 456 Q(delay\(psuDelayInMs\);)
117 468 Q(digitalWrite\(instrument1Pin, LO)117 480 Q(W\);)-.35 E
-(delay\(1000\);)117 492 Q(})97 504 Q(})77 528 Q .4 LW 540 530.5 72 530.5
-DL 540 74.5 540 530.5 DL 72 74.5 540 74.5 DL 72 530.5 72 74.5 DL .358
-(It is relati)72 543.6 R -.15(ve)-.25 G .358(ly simple in function, whe\
-n the switch on pin 2 goes high, it will send a lo).15 F 2.857(wt)-.25 G
-2.857(ot)-2.857 G .357(he PSU \(the PSU is ac-)-2.857 F(ti)72 555.6 Q
-.399 -.15(ve l)-.25 H .599 -.25(ow i).15 H 2.599(nt).25 G .099
-(his case\) and a high to the spectrometer \(acti)-2.599 F .4 -.15(ve h)
--.25 H .1
-(igh\). The setup function \(de\214ned in the \214rst set of {}\) is).15
-F .243
-(used to initialise the pins, and the loop function will be run as f)72
-567.6 R .243(ast as the microcontroller can. It constantly checks if)-.1
-F .879(the trigger pin goes lo)72 579.6 R 3.379(w\()-.25 G .879(the b)
--3.379 F .879(utton has shorted pin 2\) and if it does it sends a pulse\
- of pulseDurationInMS do)-.2 F(wn)-.25 E .657(each wire. The v)72 591.6
-R .657(ariable psuDelayInMs is used to set ho)-.25 F 3.156(wm)-.25 G
-.656(uch sooner the PSU will trigger compared to the spec-)-3.156 F
-(trometer)72 603.6 Q(.)-.55 E/F1 10/Times-Bold@0 SF 2.5(1.2. The)72
-639.6 R -.18(re)2.5 G(sults).18 E F0 1.6 -.8(We m)72 655.2 T
+(delay\(1000\);)117 492 Q(})97 504 Q(})77 528 Q .4 LW 504 530.5 72 530.5
+DL 504 74.5 504 530.5 DL 72 74.5 504 74.5 DL 72 530.5 72 74.5 DL
+(It is relati)72 543.6 Q -.15(ve)-.25 G(ly simple in function, when the\
+ switch on pin 2 goes high, it will send a lo).15 E 2.5(wt)-.25 G 2.5
+(ot)-2.5 G(he PSU \(the)-2.5 E(PSU is acti)72 555.6 Q .3 -.15(ve l)-.25
+H .5 -.25(ow i).15 H 2.5(nt).25 G
+(his case\) and a high to the spectrometer \(acti)-2.5 E .3 -.15(ve h)
+-.25 H(igh\). The setup function \(de\214ned in).15 E(the \214rst set o\
+f {}\) is used to initialise the pins, and the loop function will be ru\
+n as f)72 567.6 Q(ast as the)-.1 E
+(microcontroller can. It constantly checks if the trigger pin goes lo)72
+579.6 Q 2.5(w\()-.25 G(the b)-2.5 E(utton has shorted pin 2\) and if it)
+-.2 E(does it sends a pulse of pulseDurationInMS do)72 591.6 Q
+(wn each wire. The v)-.25 E(ariable psuDelayInMs is used to set ho)-.25
+E(w)-.25 E
+(much sooner the PSU will trigger compared to the spectrometer)72 603.6
+Q(.)-.55 E/F1 10/Times-Bold@0 SF 2.5(1.2. The)72 639.6 R -.18(re)2.5 G
+(sults).18 E F0 1.6 -.8(We m)72 655.2 T
(easured results using a green LED, and our pulse').8 E 2.5(sh)-.55 G
(ad a width of 450ms)-2.5 E 2.5(Ag)72 679.2 S
(raph of results can be found belo)-2.5 E(w:)-.25 E 0 Cg EP
@@ -369,8 +335,8 @@ R .657(ariable psuDelayInMs is used to set ho)-.25 F 3.156(wm)-.25 G
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-3-)300.17 48 Q 14 14 468 819 -136 238 72 220
-PBEGIN
+/F0 10/Times-Roman@0 SF(-3-)282.17 48 Q 14 14 432 819 -125.538 238 72
+209.539 PBEGIN
%%BeginDocument: graph.ps
%!PS-Adobe-3.0
%%Creator: GIMP PostScript file plug-in V 1.17 by Peter Kirchgessner
@@ -2802,32 +2768,31 @@ showpage
end
%%EOF
%%EndDocument
-end PEND/F1 10/Times-Italic@0 SF 2.5(ya)72.74 235.6 S
-(xis = wavelength \(nm\), x axis = curr)-2.5 E(ent \(mA\))-.37 E F0
-2.997(Im)72 251.2 S .497(odelled a line of best \214t for this graph to\
- be y = 1/9x + 568.4, with X being the current in mA, and Y being the)
--2.997 F -.1(wa)72 263.2 S -.15(ve)-.1 G 1.585(length in nm; ho).15 F
-(we)-.25 E -.15(ve)-.25 G 4.085(rt).15 G 1.585(his is just by e)-4.085 F
-1.585(ye. From this one can assume the temperature coef)-.15 F 1.584
-(\214cient to be 1/9)-.25 F(nm/mA.)72 275.2 Q .222(The results sho)72
-299.2 R 2.722(wt)-.25 G .222(hat as the LED had more current \215o)
--2.722 F .223
-(wing through it, the colour of the light it produced changed to)-.25 F
-2.5(ah)72 311.2 S(igher w)-2.5 E -2.25 -.2(av e)-.1 H(length \(to).2 E
--.1(wa)-.25 G(rds red\).).1 E .305(It is w)72 335.2 R .305(orth noting \
-that when we reduced the pulse duration to 300ms instead of 450ms, at 3\
-0mA the w)-.1 F -2.25 -.2(av e)-.1 H .305(length fell).2 F .582
-(to 570.61nm, which suggests that e)72 347.2 R -.15(ve)-.25 G 3.082(no)
-.15 G 3.082(nap)-3.082 G .582
-(ulse as small as 450ms the heating of the LED has ef)-3.082 F .582
-(fected its w)-.25 F -2.25 -.2(av e)-.1 H(-).2 E(length.)72 359.2 Q .186
-(Of note we found that there w)72 383.2 R .186(as a tin)-.1 F 2.686(yd)
--.15 G .186(elay between when the when the spectrometer went high, and \
-the PSU went)-2.686 F(lo)72 395.2 Q 1.3 -.65(w, w)-.25 H 2.5(ef).65 G
+end PEND/F1 10/Times-Italic@0 SF 2.5(ya)72 225.139 S
+(xis = wavelength \(nm\), x axis = curr)-2.5 E(ent \(mA\))-.37 E F0 2.5
+(Im)72 240.739 S(odelled a line of best \214t for this graph to be y = \
+1/9x + 568.4, with X being the current in mA, and Y)-2.5 E(being the w)
+72 252.739 Q -2.25 -.2(av e)-.1 H(length in nm; ho).2 E(we)-.25 E -.15
+(ve)-.25 G 2.5(rt).15 G(his is just by e)-2.5 E
+(ye. From this one can assume the temperature)-.15 E(coef)72 264.739 Q
+(\214cient to be 1/9 nm/mA.)-.25 E(The results sho)72 288.739 Q 2.5(wt)
+-.25 G(hat as the LED had more current \215o)-2.5 E
+(wing through it, the colour of the light it produced)-.25 E
+(changed to a higher w)72 300.739 Q -2.25 -.2(av e)-.1 H(length \(to).2
+E -.1(wa)-.25 G(rds red\).).1 E(It is w)72 324.739 Q(orth noting that w\
+hen we reduced the pulse duration to 300ms instead of 450ms, at 30mA th\
+e)-.1 E -.1(wa)72 336.739 S -.15(ve)-.1 G
+(length fell to 570.61nm, which suggests that e).15 E -.15(ve)-.25 G 2.5
+(no).15 G 2.5(nap)-2.5 G(ulse as small as 450ms the heating of the LED)
+-2.5 E(has ef)72 348.739 Q(fected its w)-.25 E -2.25 -.2(av e)-.1 H
+(length.).2 E(Of note we found that there w)72 372.739 Q(as a tin)-.1 E
+2.5(yd)-.15 G
+(elay between when the when the spectrometer went high, and the)-2.5 E
+(PSU went lo)72 384.739 Q 1.3 -.65(w, w)-.25 H 2.5(ef).65 G
(ound it to be around 6us, we belie)-2.5 E .3 -.15(ve t)-.25 H
-(his to be because the spectrometer is set to go high \214rst.).15 E
-(This ef)72 419.2 Q(fect can be seen in this oscilloscope:)-.25 E 14 14
-385 385 -205 205 113.5 636.2 PBEGIN
+(his to be because the spectrometer is set to go high).15 E(\214rst.)72
+396.739 Q(This ef)72 420.739 Q(fect can be seen in this oscilloscope:)
+-.25 E 14 14 385 385 -205 205 95.5 637.739 PBEGIN
%%BeginDocument: scope.ps
%!PS-Adobe-3.0
%%Creator: GIMP PostScript file plug-in V 1.17 by Peter Kirchgessner
@@ -62350,43 +62315,41 @@ showpage
end
%%EOF
%%EndDocument
-end PEND F1(The yellow tr)71.91 648.2 Q(aces is the spectr)-.15 E
-(ometer)-.45 E 2.5(,t)-1.11 G(he blue is the PSU)-2.5 E/F2 10
-/Times-Bold@0 SF 2.5(1.3. T)72 684.2 R(ak)-.92 E(eaways)-.1 E F0 .689
-(From this e)72 699.8 R .689(xperience I think I should tak)-.15 F(ea)
--.1 E -.1(wa)-.15 G 3.189(yt).1 G .689(hat, \214rst LED')-3.189 F 3.19
-(sa)-.55 G .69(re ef)-3.19 F .69(fected by temperature v)-.25 F .69
-(ery slightly)-.15 F 3.19(,a)-.65 G .69(nd that)-3.19 F .52
-(the equipment resolution/accurac)72 711.8 R 3.02(yi)-.15 G 3.02(si)
--3.02 G .519(mportant to note, my results may be wrong, ho)-3.02 F(we)
--.25 E -.15(ve)-.25 G 3.019(rt).15 G .519(he trend sho)-3.019 F .519
-(wn by that)-.25 F
-(graph is correct, I \214nd this interesting and important.)72 723.8 Q 0
-Cg EP
+end PEND F1(The yellow tr)72 649.739 Q(aces is the spectr)-.15 E(ometer)
+-.45 E 2.5(,t)-1.11 G(he blue is the PSU)-2.5 E/F2 10/Times-Bold@0 SF
+2.5(1.3. T)72 685.739 R(ak)-.92 E(eaways)-.1 E F0(From this e)72 701.339
+Q(xperience I think I should tak)-.15 E(ea)-.1 E -.1(wa)-.15 G 2.5(yt).1
+G(hat, \214rst LED')-2.5 E 2.5(sa)-.55 G(re ef)-2.5 E
+(fected by temperature v)-.25 E(ery slightly)-.15 E(,)-.65 E
+(and that the equipment resolution/accurac)72 713.339 Q 2.5(yi)-.15 G
+2.5(si)-2.5 G(mportant to note, my results may be wrong, ho)-2.5 E(we)
+-.25 E -.15(ve)-.25 G 2.5(rt).15 G(he)-2.5 E(trend sho)72 725.339 Q
+(wn by that graph is correct, I \214nd this interesting and important.)
+-.25 E 0 Cg EP
%%Page: 4 4
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-4-)300.17 48 Q(I')72 84 Q .689 -.15(ve b)-.5 H
-(elie).15 E .689 -.15(ve t)-.25 H .389(his w).15 F .39(ork will help me\
- in further life, it really has been my \214rst glimpse into a real w)
--.1 F .39(orking w)-.1 F .39(orld with)-.1 F(electronics, I look forw)72
-96 Q(ard to w)-.1 E(orking more on it.)-.1 E/F1 10/Times-Bold@0 SF 2.5
-(2. Building)72 132 R(LED')2.5 E(s)-.37 E F0 1.32(The process consists \
-of taking the die which is made from silicon and a handful of other met\
-als that decide the)72 147.6 R -.1(wa)72 159.6 S -.15(ve)-.1 G 1.527
+/F0 10/Times-Roman@0 SF(-4-)282.17 48 Q(I')72 84 Q .3 -.15(ve b)-.5 H
+(elie).15 E .3 -.15(ve t)-.25 H(his w).15 E(ork will help me in further\
+ life, it really has been my \214rst glimpse into a real w)-.1 E(orking)
+-.1 E -.1(wo)72 96 S(rld with electronics, I look forw).1 E(ard to w)-.1
+E(orking more on it.)-.1 E/F1 10/Times-Bold@0 SF 2.5(2. Building)72 132
+R(LED')2.5 E(s)-.37 E F0(The process consists of taking the die which i\
+s made from silicon and a handful of other metals that decide)72 147.6 Q
+(the w)72 159.6 Q -2.25 -.2(av e)-.1 H
(length of the light emitted. The die is placed on a package with apoxy)
-.15 F 4.028(,t)-.65 G 1.528(hat contains silv)-4.028 F(er)-.15 E 4.028
-(,t)-.4 G 1.528(hen a wire is)-4.028 F
-(bonded to the top \(see pictures\), to the other part of the package.)
-72 171.6 Q(Here is some images of the process or wire bonding LED')72
-195.6 Q(s:)-.55 E 0 Cg EP
+.2 E 2.5(,t)-.65 G(hat contains silv)-2.5 E(er)-.15 E 2.5(,t)-.4 G
+(hen a)-2.5 E(wire is bonded to the top \(see pictures\), to the other \
+part of the package.)72 171.6 Q
+(Here is some images of the process or wire bonding LED')72 195.6 Q(s:)
+-.55 E 0 Cg EP
%%Page: 5 5
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-5-)300.17 48 Q 14 14 468 721 -623.784 961 72
-707.783 PBEGIN
+/F0 10/Times-Roman@0 SF(-5-)282.17 48 Q 14 14 432 721 -575.8 961 72
+659.8 PBEGIN
%%BeginDocument: wirebonds.ps
%!PS-Adobe-3.0
%%Creator: GIMP PostScript file plug-in V 1.17 by Peter Kirchgessner
@@ -646892,15 +646855,15 @@ showpage
end
%%EOF
%%EndDocument
-end PEND/F1 10/Times-Italic@0 SF 2.5(Av)73.01 719.783 S(ie)-2.5 E 2.5
-(wo)-.15 G 2.5(ft)-2.5 G(he die on the pac)-2.5 E(ka)-.2 E .2 -.1(ge, a)
--.1 H(nd the mac).1 E(hine)-.15 E 0 Cg EP
+end PEND/F1 10/Times-Italic@0 SF 2.5(Av)72 671.8 S(ie)-2.5 E 2.5(wo)-.15
+G 2.5(ft)-2.5 G(he die on the pac)-2.5 E(ka)-.2 E .2 -.1(ge, a)-.1 H
+(nd the mac).1 E(hine)-.15 E 0 Cg EP
%%Page: 6 6
%%BeginPageSetup
BP
%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-6-)300.17 48 Q 14 14 468 721 -623.784 961 72
-707.783 PBEGIN
+/F0 10/Times-Roman@0 SF(-6-)282.17 48 Q 14 14 432 721 -575.8 961 72
+659.8 PBEGIN
%%BeginDocument: wirebonds2.ps
%!PS-Adobe-3.0
%%Creator: GIMP PostScript file plug-in V 1.17 by Peter Kirchgessner
@@ -1235252,18 +1235215,13 @@ showpage
end
%%EOF
%%EndDocument
-end PEND/F1 10/Times-Italic@0 SF 2.5(Av)73.01 719.783 S(ie)-2.5 E 2.5
-(wt)-.15 G(hr)-2.5 E(ough the lens)-.45 E 0 Cg EP
-%%Page: 7 7
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(-7-)300.17 48 Q .072(This w)72 84 R .072(as a v)
--.1 F .072(ery interesting process to see, I al)-.15 F -.1(wa)-.1 G .071
-(ys imagined an LED as one bit of metal that did the job, I had ne).1 F
--.15(ve)-.25 G(r).15 E(through ho)72 96 Q 2.5(wm)-.25 G(uch precision w)
--2.5 E(ork went into it. The LED')-.1 E 2.5(sw)-.55 G 2.5(ew)-2.5 G(ork)
--2.6 E(ed on were 280um x 280um.)-.1 E 0 Cg EP
+end PEND/F1 10/Times-Italic@0 SF 2.5(Av)72 671.8 S(ie)-2.5 E 2.5(wt)-.15
+G(hr)-2.5 E(ough the lens)-.45 E F0(This w)72 687.4 Q(as a v)-.1 E
+(ery interesting process to see, I al)-.15 E -.1(wa)-.1 G
+(ys imagined an LED as one bit of metal that did the job, I).1 E(had ne)
+72 699.4 Q -.15(ve)-.25 G 2.5(rt).15 G(hrough ho)-2.5 E 2.5(wm)-.25 G
+(uch precision w)-2.5 E(ork went into it. The LED')-.1 E 2.5(sw)-.55 G
+2.5(ew)-2.5 G(ork)-2.6 E(ed on were 280um x 280um.)-.1 E 0 Cg EP
%%Trailer
end
%%EOF