Thursday, 31 December 2015

funary 0.2.6

funary 0.2.6 is the last release of 0.2.x and it will be adequate for DLCSim. More operations for big endianness might be added in the future.

Tuesday, 22 December 2015

Raspberry PI Bluetooth PAN

How to get Raspberry PI Bluetooth PAN to work.

On Raspberry Pi machine.
  1. Install bluez, bluez-utils
  2. modprobe btusb
  3. Start bluetooth service
  4. Trust and pair client machine
  5. Create PAN network
    1. brctl addbr pan0
    2. brctl setfd pan0 0
    3. brctl stp pan0 off
    4. ip addr add 10.1.2.3/24 dev pan0
    5. ip link set pan0 up
  6. bt-pan --debug server pan0

On client machine.
  1. Install bluez, bluez-utils, and blueman
  2. modprobe btusb
  3. Start bluetooth service
  4. Start blueman
  5. Trust and pair Raspberry Pi machine
  6. bt-pan client XX:XX:XX:XX:XX:XX
  7. Configure IP and netmask 

bt-pan

Sunday, 13 December 2015

Zynq design steps

  1. Design component in MATLAB
  2. Test component in MATLAB
  3. Generate IP core
  4. Verify & Optimize IP core
  5. Create base project in Xilinx Vivado
  6. Connect IP core to processing system in base project
  7. Generate bitstream
  8. Program FPGA
  9. Create software to interface with FPGA
  10. Test system with component
  11. Repeat for each component

Tuesday, 1 December 2015

Code::Blocks for embedded systems

Code::Blocks does support AVR and ARM. AVR support is very matures and supports the whole range of AVR MCUs. However, ARM support is very limited. The detection of GCC for ARM is very poor and you must configure the compiler settings manually. On the other hand, I am looking forward for the new release of Code::Blocks.

Website:
www.codeblocks.org/

Em::Blocks/EmBitz for ARM developement



EmBlocks/EmBitz is a good IDE for ARM development. It uses GCC for ARM. Moreover, it allows OpenOCD for debugging. The EmBitz beta look interesting. I used it and it seems to support STM32 MCUs. It also support some PIC MCUs. I would prefer this over Eclipse because Eclipse is very glitchy on windows.

Website:
http://www.emblocks.org

Saturday, 31 October 2015

My setup for web development

I normally use Brackets for my main IDE. Brackets does syntax highlighting, live previews, and control revision.

For control revision, I prefer git and github to host the source code. There is a plugin for Brackets.

For live previews, I use Chromium/Google Chrome with livereload. Also has a plugin.

For node.js development, I use grunt and qunit for testing and deployment.

Thursday, 22 October 2015

funary 0.2.x

funary goal is support DLCSim and future projects with binary operations.


 funary 0.2.x Specification:
High priority:
  • Multiplication
  • Decoders
  • Encoders
  • Multiplexers
  • Demultiplexers
  • Bit-wise operations
  • Truncation
  • Shifting
  • Decimal to binary
Low priority:
  • Subtraction
  • Division
  • Modulus

Friday, 16 October 2015

DLCSim 0.3.x

DLCSim 0.3.x will have the following:
  • Full adders
  • RS latches
  • n-bit adders
  • Decoders
  • Encoders
  • Multiplexers
  • Demultiplexers
  • Pulse generators
  • Real-time simulations
Real-time simulations will simulate the circuit in real time. It will have delays in gates and ICs. The values will update automatically as they pass though the circuit.

Monday, 12 October 2015

DLCSim 0.2.2 - Oct 12 2015

I released a new version with better IC support. Now the next task will be to create visualization of the circuit and add more ICs.

Sunday, 11 October 2015

DLCSim 0.1.0 - Oct 11 2015

I made a new digital logic library for fun.

DLCSim

Example:

It is pretty small right now. It has only AND,XOR,OR,NOR components. But using those components you could build any circuit.

The library could be easily extended to add NAND,NOR,...etc. However, components that have multiple outputs could have a problem.


Thursday, 1 October 2015

ARM Assembly cheat sheet

ARM assembly

Instruction set


nop

No instruction. Does nothing. Used for alignment.


b

Branch off and go to a label.


Example:
b start
Execution goes to the label start.


mov

Move a value to a register. 8 bits maximum.


Example:
mov r0,#1
Moves value 1 to r0. r0 equals 1.


add

Adds two values together and place it to a register.


Example:
add r0,r1,r2
Adds r1 and r2 together. Then places it in r0.


ldr

Load a value to a register. Use this instruction when mov can't.


Example 1:
ldr r0,=r1
Loads r1's address to r0. Not r1's value.


Example 2:
ldr r0, [r1]
Loads value from given address(r1's value) and place it in r0.


Example 3:
ldr r0, [r1,r2]
Loads value from given address(r1's and r2's value) and place it in r0.


Example 4:
ldr r0,=0x10000000
Place 0x10000000 into r0. r0 equals 0x10000000.


str

Store value into memory location.Memory location is the data section.


Example:
str r0,[r1]
Store r0's value in the at the address given(r1's value).


cmp

Compares two registers and see if they are above zero. It subtracts internally.


Example 1:
cmp r0,r1
Sets N,Z,V,C condition flags with the data of r0-r1. Negative,Zero,Overflow,Carry.


Example 2:
cmp r0,#3
bge start
Performs r0-3.
If it is negative then N = true.
If it is overflowing then V = true.
If N == V or GE then go to start label.


bge

Checks if N == V or GE then goes to the branch see above.




Software used: ARMSim

Tuesday, 29 September 2015

nerdamer To Do Sept 29 2015

I am halting development of nerdamer for a while. But if I ever resume, here is a to do list:

Short term:
  • Fix Fourier transform's reliance on text replace for substitution
  • Add more tests
  • Add RESTFUL API
  • Update website

Long term:
  • Add ODEs
  • Add ODE solver
  • Add graphing API
  • Finish integration
  • Finish Forward Fourier transform
  • Start Inverse Fourier transform
  • Add arbitrary precision

Sunday, 27 September 2015

Flaws of bower

bower is very inferior to npm as of Sept 2015. bower has no system of depreciation, maintainers, and caching.

  1. npm has a depreciation system called npm deprecate .With it you could depreciate old versions of a package. You also could give warnings about bugs and patches. In bower, it doesn't exist so users could install broken packages. This would cause a lot of broken code caused by the bower dependencies.
  2. bower relies on a single repository with a single maintainer. Most of the time it authenticates with GitHub. You have to use bower login to do  read/write operations. This is a single point of failure as it relies on a single repository and a single account. This leads to another problem.
  3. To switch permissions and ownership to another maintainer you will have to ask the bower core team. Why isn't this automated?
  4. bower only caches the most recent version. If you want to retrieve older versions, it uses tags and retrieves the correct version from releases(GitHub again). This means you could change old versions of package without the users knowing. For example, User A install beep 0.7.0 (old version). User A check package and thinks it a good package. User A build the API on top of beep 0.7.0 . Maintainer changes beep 0.7.0's API to something else. When User A deploys beep 0.7.0, all the deployed systems breaks down with incompatible API.
In conclusion, just use browserify.

Monday, 21 September 2015

LyX and minted

Guide for using minted on lyx. minted is TeX package that provides syntax highlighting. It is useful for displaying code.



Tools -> Preferences



File Handling -> Converters
Select Latex -> PDF
Add "-shell-escape" to converted
Click Modify
Hit Save



Document -> Settings



Select LaTeX Preamble
Add "\usepackage{minted}"
Hit Ok



Insert -> TeX code



Add the code and done!

Friday, 18 September 2015

nerdamer Single variable Talyor Series Sept 18 2015

Single variable Taylor series expansion is a straight forward method.
f(a)+\frac {f'(a)}{1!} (x-a)+ \frac{f''(a)}{2!} (x-a)^2+\frac{f'''(a)}{3!}(x-a)^3+ \cdots.
The code:



Starting at 1. It takes a function f and takes the derivative and evaluates it at point a. Then it divides it by a factorial. Then it moves on to the next term and so on...


The applications:

Approximating solution of hard integrals:




Solving ODEs

Tuesday, 8 September 2015

nerdamer Fourier Transform cosine and sine Sept 8 2015

I managed to get cosine and sine function to work by converting it to exponential form and evaluating it.

So far the tests:



The new tests contain cosine and sine functions with frequency shifts.
The forward Fourier Transform is about 40% done.
It still needs:
  • Differential equations(important)
  • Convolution
  • Integral equations
  • Amplitude modulation
  • Special functions(e.g. cos(at^2))
  • Frequency differentiation
  • Frequency integration

It might be the last update for a while since I have other work to do.

Saturday, 5 September 2015

Circuitsolver specification

Circuitsolver is the core library of Circuit Simulator. It was created to solve circuit problems.

Specification for inputs in the DC solver. DC solver accepts an array of arrays.

Example of DC solver input:



Types of elements:

 

Wire:


Other types:


Keep in mind the solver reads from the end to the front. The front of the array could have other values and arrays.




Tuesday, 1 September 2015

Travis CI auto push gh-pages with grunt

Get the token

Go here https://github.com/settings/tokens and get the personal token. Check public_repo for public repositories.

Encrypt it with travis encrypt



Place it in secure in .travis.yml




Create package.json


Be sure to have grunt,grunt-gh-pages,and grunt-contrib-copy as dev dependencies.


Create Gruntfile.js


You need to copy correct files to the correct directory which is 'dist' with
grunt-contrib-copy.




Enjoy.

Sunday, 30 August 2015

CircuitSimulator Component Specification Aug 30 2015

I made some progress to circuit simulator with a the addition of components.


Now there is a components dialog with a list of components.

Example component:

So here is the component specification:

  • component_name represents the tooltip name
  • graphic represents how the component is drawn on the grid
  • icon is data for the img on the button
  • id is reference id with is used to retrieve properties for components
  • attributes are the component's values(e.g voltage,current,resistance)
graphic specification is different:
  • polygon represents a polygon,it has [x1,y1,x2,y2,x3,y3 ...] coordinates for every point
  • line represents a line [x1,y1,x2,y2]
  • linecircle is a circle made of lines [centerx,centery,outerradius,thickness]








Friday, 28 August 2015

nerdamer2AsciiMath Aug 29 2015

nerdamer has built in LaTeX generation but it lacks some support for some symbols. nerdamer2AsciiMath is meant to fill the gaps of the support and be independent of nerdamer. nerdamer2AsciiMath is better off independent from nerdamer because of these reasons:
  • nerdamer needs to be lightweight
  • nerdamer is mostly a parser
  • development cycles don't match up
  • both projects need to be simple
nerdamer2AsciiMath purpose is to parse nerdamer symbols into AsciiMath. From there you could convert them into LaTeX or MathML.

nerdamer LaTeX bug Aug 28 2015

I wrote some tests for the LaTeX in preparation for fix this bug.


After an hour of narrowing down the code in the LaTeX generation. I came across this....


The abs value tells the function to ignore the signs of the symbols. The first symbol is treated differently from the other symbols some how.

Well I took a guess and comment that line out and this happened.


The bug is now fixed somehow? Or I might have introduced new bugs?



Wednesday, 26 August 2015

Circuit Simulator Moving from qooxdoo to jquery ui Aug 26 2015

I have been using qooxdoo for a while.... and it is not bad. However, qooxdoo desktop version is very very heavy and has lots of dependencies. So I won't use it. Also the build time takes a while even if your application is very minimal.

On jquery ui side. The fonts don't resize well so I will have to use fortawesome instead.

Tuesday, 25 August 2015

Circuit simulator Aug 25 2015

Today, I built the foundation for a circuit simulator. It will use easeljs for the graphics, qooxdoo for UI,C3 for graphs, and nerdamer for equation solving.

Specification for Circuit Simulator 0.1.0:
  • Solve all resistor networks
  • Solve all networks with constant voltage sources
  • Save and load .sch files
  • Develop plug able modules
  • Write tests

nerdamer Symbolic Continuous Time Fourier Transform Aug 25 2015

Some progress has been made on the symbolic Fourier Transform. It was very hard to check the output using software because most of the software packages use numerical methods instead of symbolic. That makes them discrete instead of continuous. The other packages that are symbolic don't have advanced features. So I had to check them by hand.

The tests:


Right now, it has basic functions,time/frequency shift, and linearity. This makes nerdamer unique because there isn't any other javascript library that could do symbolic Fourier transform.

I have to get cos,sine,differential/integral equations, convolution ,amplitude shifting... and so on..


Sunday, 23 August 2015

nerdamer npm Aug 23 2015

If you read this. Then you know why nerdamer 0.5.6 doesn't exist on npm.

I can't undo the 0.5.6 publish,so I published 0.5.3 instead.

The npm package is identical with the releases except it has package.json.

How to use:
npm install nerdamer

node
>var nerdamer = require('nerdamer');
>nerdamer('2+4').symbol.text()
6
>var nerdamer = require('nerdamer/Calculus.js');
>nerdamer('diff(x,x,1)').symbol.text()
1

npm publish Aug 23 2015

npm is a harsh tool. npm publish is final and there is no going back ever.

If you publish a package with a version number. Then decide to update the package with the same version number. It won't let you. It also give no warning that publishing is final. So never publish anything until you are sure it works.

nerdamer Travis CI Aug 23 2015

For dev branch only not master

Travis CI is a cloud service that builds and tests software packages.I am focusing on node.js ,grunt, and qunit.


The basic idea is the package runs grunt. Then grunt runs the qunit tests. If the qunit tests pass then the badge will be green.
Smiley face


Starting with .travis.yml


 The language of the tests is set to node.js which is javascript. The versions 0.10, 0.11 , 0.12 tell it to only run tests under those. npm install -g grunt-cli tells it to install grunt before running the script.


package.json

The information for a node.js package. The important part is the scripts. It tells node.js to run grunt.


Grunt looks for a file called Gruntfile.js

It uses qunit to go through all the tests.

Well on to packaging for npm.



Saturday, 22 August 2015

nerdamer Powers Aug 22 2015

The original this.pow didn't check for edge cases and was written weirdly.

For one of the edge cases 0^0, the original code was:

The code didn't account for symbol1 to be 0 or infinity. The fix only applies to 0. Infinity is another case.......

Modified code:


Now for other other case of (-1)^x being wrong. The original:

I isolated the problem to Math.abs(symbol1.multiplier). Why Math.abs? I have no idea. It just doesn't work if symbol1.multiplier is -1.

Fixed code:


The problem is covert function doesn't account for negative numbers again....

Original convert code:

Math.abs(this.multiplier) is the problem again...

New convert code:

Now that the exponents are fixed... I need to fix the rounding issues.


Friday, 21 August 2015

nerdamer exp for complex numbers Aug 21 2015

After creating the im and re functions. I have to fix the exp function.

For any complex argument in exp:


It is just Euler's formula and exponent laws. a is real part and b is imaginary part.


So the new exp function becomes:




On to solving the (a+bi)^(f(x)) bug.....

nerdamer Complex numbers Aug 21 2015

nerdamer is lacking some functions for complex numbers.
So... I made functions for re, and im.

re takes in a complex number and gives the real part:


The function breaks down the symbols by + -. Then it filters the real part of the symbol and adds them up.

im function does the same thing:

However it divides by i at the end.





I also had to change the callfunction to take in complex numbers:

Thursday, 20 August 2015

OSEPP as an ISP Aug 20 2015

I bought a OSEPP Uno R3 Plus for an ISP, but I can't get it to work. I tested the functional of OSEPP before trying to program an atmega328p-pu. OSEPP  works works for everything except as an ISP. I only used the minimal configuration for an ISP. It might be the internal quartz crystal of OSEPP that is not working.

Wednesday, 19 August 2015

nerdamer Symbols Aug 19 2015

Everything in nerdamer revolves around symbol manipulation..... well most of the time.

Staring with a simple symbol
It looks like a function. You can see it from the group value. group: 4. Each symbol is organised into one of these groups:


 Group 4 belongs to the function, so it makes sense.
Moving on, multiplier is "5" in "5*delta". It doesn't make a lot of sense for it to be group with the function symbol. It should be a symbol by itself. The value is text without the multiplier. Ok... args is the arguments of the function.

Closer inspection of this argument.

 We are looking at "t+t^2". Again the group: 5 is some kind of polynomial. The value is t,so it is polynomial made out of t. The symbols of the object is the individual components.

Even.. deeper


Aha it is just "t" and "t^2". The parser breaks up the input by * / + -
So each symbol is just seperated by those operators.

Another example:



 You can see the structure is just like a tree.