Close
0%
0%

Learning Python

Learning Python

Similar projects worth following
288 views
0 followers
Learning Python

I heard people enthuse about python years ago but I said I could not be bothered to learn new languages when I already understood C and C++. Most gadgets I meet at work have a small microcontroller, with embedded software is written in C, and can't support a large interpreter. 

However, I do need to work with PC-based test rigs and these do use python. So I had to look at some test rig code. Thankfully it was very well written and organised which made it very easy for me to read and work out what was going on. I'm sure that many peoples' code is not so well written and that includes myself.

Writing code is a different matter, the best way to get good at something is practice, practice and practice. So here I am setting myself learning exercises.

autogenerated_IC_packages_as_html_tables.zip

Test pages and style sheet

Zip Archive - 5.54 kB - 05/20/2024 at 21:59

Download

  • Porting a Particle Physics data scraper

    Keith06/04/2024 at 14:39 0 comments

    I definitely did not write this myself, it is running on the very big computer of a very big facility. It needed work to get running on a personal computer.  A missing file, some corrections, and a few replacements of deprecated functions.

    My floor-top Linux PC from 2007 has a 3 GHz quad-core i7 CPU and 6Gbytes of RAM, which is fine for everything I do at home. Amazing to think I haven't needed to buy a new computer since then (apart from buying bigger disk drives). 

    The four data sets are very big so the analyser software scrapes the data it wants from the web files. The software takes about 72 minutes to process the first and smallest file, but Linux kills it when it tries the other, larger files. I think this is because it exhausts the memory resources. The 2Gbyte of swap file space hits 97% utilised. 

    I shall try it on my workplace laptop (dated 2022), which has 32 Gbyte of RAM. The CPU is an i7 quad-core i7, about the same processing power as my floor-top PC.

  • Learning courses

    Keith05/21/2024 at 23:55 0 comments

    2024-05-21 

    After creating my chip-pinout to html renderer in Python, I spent a few days watching Introduction to Python videos. 

    The introductory stuff was a bit too basic, I'd have prefer a few short examples of C++ and Python constructs side by side. Most languages have for-next and do-while loops. Python has a significantly different way of iterating.

    What I found exciting was that there are many libraries to parse HTML pages from the net to extract data from the web. Or XML and JSON files.

    HTML parsing is interesting to me because I'd like to scrape component descriptions and CAD library data from web pages, using software rather than scrolling through sites and clicking download buttons.

    XML parsing may be helpful analysing and importing KiCad files.

  • Rendering IC pinouts in html

    Keith05/20/2024 at 01:27 0 comments

    I often use html tables to show IC pinouts in my projects.

    A while ago, I wrote a program in C to generate such tables with numbered pins.

    I decided to convert this to python as a learning exercise.

    I can't add html and styles direct to this page, so here are some screen shots.

    My test page has all the common sizes up to 208 pins, which would have been very tedious to construct by hand.

    I then extended it to add cells for pin names and signal directions.

    Here is the Z80:

    And here is the FT232H:

    Chip objects take a set of signal names then map names to pins and vice versa. They then call functions inherited from their parent class to construct the table.

    2024-05-20

    Added the ability to rotate the table by 45 degrees, by adding two buttons and a tiny amount of Javascript. You'll have to download, unzip and try it yourself.

    To do:

    • Think of the best way to manage signal to pin mapping
    • Modify to handle chips with pin 1 in top centre (most PLCC chips)
    • Add signal type direction indicator arrows (in, out, inout) between pins and names

View all 3 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates