Sunday, March 29, 2020

Mussle Stimulater with AVR 32




  1. At the beginning its gives good output with 3 mS period frequency and 5~18 V output voltage range. This is need to be update while testing....! 





 This module were used to drive output in between 5~18 V range, this can operate maximum of  125 nS frequency, 

  2.  when current pass through skin 6 mA it can feel for above period(3 mS)

  3. This is 1st day test and will update with latest improvement soon

======================================================================
 
# include<avr/io.h>
# include<util/delay.h>
# define _BV(bit) (1<<bit)
# define setbit(port, bit)     (port) |= (1<<(bit))
# define clearbit(port, bit) (port) &= ~(1<<(bit))
# define togglebit(port,bit) (port) ^= (1<<(bit))

int main(void){
        DDRC = 0xFF;   // DataDirectionRegister for portc set as output
       
//===================end less loop=================       
       
    while(1){
    setbit(PORTC,PC0);  // set portc.0 HIGH
    _delay_us(1500);     // set ON delay
    clearbit(PORTC,PC0);// set portc.0 LOW
    _delay_us(1500);    // set OFF delay

    }
//================================================   
    return 0;
   
        }



Electronic Muscle Stimulaters

usbasp Drivers for windows 10

Download from my drive,

usbasp Driver for windows 10



You may need,

The Third-party INF does not Contain Digital Signature Error – Windows

 Script to Disable digital Signature Checking

If the above methods work, you can try to install the unsigned driver anyway. In this case, You will need to disable driver signature verification process:
  1. First, you have to close all the opened windows and programs of your PC.
  2. Click on Windows button and Search for cmd and you will get Command Prompt as a search result. (Right click on it & select Run as administrator option)
  3. A Command Prompt window will popup. In Command Prompt, enter the following code and press Enter key
    bcdedit /set loadoptions DDISABLE_INTEGRITY_CHECKS
  4. After writing the above code, you have to write another code and press Enter Key.
    bcdedit /set testsigning on
  5. Now, You will be able to install any unsigned driver. Then try to install again the driver.
 Disable digital signature via GUI method,
  1. Open the Start Menu, Click on Power Button.Press and hold Shift and click on Restart.
  2. Your PC will restart and show you some options on the blue screen. From there, Go to Troubleshoot > Advanced Options.
  3. Now, Click on Startup Settings and Restart.
  4. It will restart your PC and show you some other options on a blue screen. Press 7 to choose “Disable driver signature enforcement.” It will restart your PC again.
  5. Now, You will be able to install any unsigned driver.

Friday, March 20, 2020

Programing AVR on Ubuntu with USBasp

  • Install software package
sudo apt-get install gcc-avr avrdude avr-libc binutils-avr
  • AVR Program
Open your favorite editor and type following code, and save it as led.c 


#define F_CPU 1000000UL
#include
#include
int main(void) {
 DDRC = 255;
 while(1){
 PORTC=255;
 _delay_ms(200);
 PORTC=0;
 _delay_ms(200);
 }
 return 0;
}
  •  Makefile: Shoud avalable always in same folder
It is a good idea to have Makefile for compiling the c code. Download and extract Makefile
file and use the Makefile available inside the archive. This make file was generated MFILE tool under windows 7. Copy Makefile and led.c file to a given folder and run following command on the terminal
make all
You can use "make", "make all", "make clean" and "make program" commands
 
  • Downloading the firmware to AVR
We use avrdude for downloading the generated hex file to the device. Connect you
r USBasp programmer to the computer and the microcontroller. Then run following code for downloading,

sudo avrdude -p m32 -c usbasp -e -U flash:w:led.hex
 
in above code -p followed by m32 is for part number ATmega 32A; -c is for
providing  the programmer's name (hardware programmer); -e is to erase the
device before programing;  -U is to provide progrming location (in this case flash
 in write (w) mode has been selected)

 


reference: https://fos.cmb.ac.lk/esl/programing-avr-ubuntu-14-04-usbasp/ , :avrdude Linux man

Search This Blog